Files
openclaw/src/infra/bonjour-errors.ts
2026-04-08 00:09:41 +01:00

14 lines
459 B
TypeScript

import { normalizeOptionalString } from "../shared/string-coerce.js";
export function formatBonjourError(err: unknown): string {
if (err instanceof Error) {
const trimmedMessage = err.message.trim();
const msg = trimmedMessage || err.name || (normalizeOptionalString(String(err)) ?? "");
if (err.name && err.name !== "Error") {
return msg === err.name ? err.name : `${err.name}: ${msg}`;
}
return msg;
}
return String(err);
}