refactor: dedupe channel runtime error formatting

This commit is contained in:
Peter Steinberger
2026-04-07 01:21:19 +01:00
parent 77a161c811
commit 9e2a1e12fd
18 changed files with 38 additions and 34 deletions

View File

@@ -1,5 +1,6 @@
import crypto from "node:crypto";
import path from "node:path";
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
import { resolveBlueBubblesServerAccount } from "./account-resolve.js";
import { assertMultipartActionOk, postMultipartFormData } from "./multipart.js";
import {
@@ -130,7 +131,7 @@ export async function downloadBlueBubblesAttachment(
cause: error,
});
}
const text = error instanceof Error ? error.message : String(error);
const text = formatErrorMessage(error);
throw new Error(`BlueBubbles attachment download failed: ${text}`, { cause: error });
}
}

View File

@@ -1,5 +1,6 @@
import type { IncomingMessage, ServerResponse } from "node:http";
import { safeEqualSecret } from "openclaw/plugin-sdk/browser-security-runtime";
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
import { isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-runtime";
import { createBlueBubblesDebounceRegistry } from "./monitor-debounce.js";
import {
@@ -92,7 +93,7 @@ function parseBlueBubblesWebhookPayload(
try {
return { ok: true, value: JSON.parse(payload) as unknown };
} catch (error) {
return { ok: false, error: error instanceof Error ? error.message : String(error) };
return { ok: false, error: formatErrorMessage(error) };
}
}
}

View File

@@ -1,3 +1,4 @@
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
import type { BaseProbeResult } from "./runtime-api.js";
import { normalizeSecretInputString } from "./secret-input.js";
import { buildBlueBubblesApiUrl, blueBubblesFetchWithTimeout } from "./types.js";
@@ -172,7 +173,7 @@ export async function probeBlueBubbles(params: {
return {
ok: false,
status: null,
error: err instanceof Error ? err.message : String(err),
error: formatErrorMessage(err),
};
}
}