refactor: dedupe provider bootstrap error formatting

This commit is contained in:
Peter Steinberger
2026-04-07 01:15:34 +01:00
parent 8a40cd7ed4
commit 77a161c811
9 changed files with 19 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
import type { ProviderPrepareRuntimeAuthContext } from "openclaw/plugin-sdk/core";
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
import { ensureAuthProfileStore } from "openclaw/plugin-sdk/provider-auth";
import { getAccessTokenResultAsync } from "./cli.js";
import {
@@ -95,7 +96,7 @@ export async function prepareFoundryRuntimeAuth(ctx: ProviderPrepareRuntimeAuthC
...(baseUrl ? { baseUrl } : {}),
};
} catch (err) {
const details = err instanceof Error ? err.message : String(err);
const details = formatErrorMessage(err);
throw new Error(`Failed to refresh Azure Entra ID token via az CLI: ${details}`, {
cause: err,
});