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 * as dns from "node:dns";
import type { TelegramNetworkConfig } from "openclaw/plugin-sdk/config-runtime";
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
import {
createPinnedLookup,
hasEnvHttpProxyConfigured,
@@ -270,7 +271,7 @@ function createTelegramDispatcher(policy: PinnedDispatcherPolicy): {
effectivePolicy: policy,
};
} catch (err) {
const reason = err instanceof Error ? err.message : String(err);
const reason = formatErrorMessage(err);
throw new Error(`explicit proxy dispatcher init failed: ${reason}`, { cause: err });
}
}
@@ -293,9 +294,7 @@ function createTelegramDispatcher(policy: PinnedDispatcherPolicy): {
};
} catch (err) {
log.warn(
`env proxy dispatcher init failed; falling back to direct dispatcher: ${
err instanceof Error ? err.message : String(err)
}`,
`env proxy dispatcher init failed; falling back to direct dispatcher: ${formatErrorMessage(err)}`,
);
const directPolicy: PinnedDispatcherPolicy = {
mode: "direct",