MCPcopy Index your code
hub / github.com/BlockRunAI/ClawRouter / extractErrorMessage

Function extractErrorMessage

test/test-e2e.ts:311–323  ·  view source on GitHub ↗
(payload: ResponsePayload)

Source from the content-addressed store, hash-verified

309}
310
311function extractErrorMessage(payload: ResponsePayload): string {
312 if (payload.json && typeof payload.json === "object") {
313 const root = payload.json as Record<string, unknown>;
314 const error = root.error;
315 if (typeof error === "string") return error;
316 if (error && typeof error === "object") {
317 const msg = (error as Record<string, unknown>).message;
318 if (typeof msg === "string") return msg;
319 }
320 if (typeof root.message === "string") return root.message;
321 }
322 return payload.text;
323}
324
325function extractFirstMessageContent(payload: ResponsePayload): string | undefined {
326 if (!payload.json || typeof payload.json !== "object") return undefined;

Callers 1

runLocalSuiteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected