From 3a426412082abaee83b5a57f0c50d2bf640e720e Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 6 Apr 2026 23:37:20 +0100 Subject: [PATCH] refactor: dedupe provider auth error formatter --- src/plugins/provider-auth-ref.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) 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];