diff --git a/src/plugins/provider-auth-ref.ts b/src/plugins/provider-auth-ref.ts index 5472e101d00..15ea0631c14 100644 --- a/src/plugins/provider-auth-ref.ts +++ b/src/plugins/provider-auth-ref.ts @@ -1,5 +1,6 @@ import type { OpenClawConfig } from "../config/types.js"; import { isValidEnvSecretRefId, type SecretRef } from "../config/types.secrets.js"; +import { formatErrorMessage } from "../infra/errors.js"; import { encodeJsonPointerToken } from "../secrets/json-pointer.js"; import { getProviderEnvVars } from "../secrets/provider-env-vars.js"; import { @@ -32,13 +33,6 @@ export type SecretRefSetupPromptCopy = { providerValidatedMessage?: (provider: string, id: string, source: "file" | "exec") => string; }; -function formatErrorMessage(error: unknown): string { - if (error instanceof Error && typeof error.message === "string" && error.message.trim()) { - return error.message; - } - return String(error); -} - export function extractEnvVarFromSourceLabel(source: string): string | undefined { const match = ENV_SOURCE_LABEL_RE.exec(source.trim()); return match?.[1];