mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-21 14:22:14 +03:00
14 lines
330 B
TypeScript
14 lines
330 B
TypeScript
import { sanitizeErrorMessage } from "../utils/error.ts";
|
|
|
|
export function toSafeMcpErrorMessage(
|
|
value: unknown,
|
|
fallback = "MCP tool execution failed"
|
|
): string {
|
|
try {
|
|
const raw = value instanceof Error ? value.message : value;
|
|
return sanitizeErrorMessage(raw) || fallback;
|
|
} catch {
|
|
return fallback;
|
|
}
|
|
}
|