MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / jsonRpcError

Function jsonRpcError

e2e/cloud/mcp-destroyed-session-envelope.test.ts:90–102  ·  view source on GitHub ↗
(body: string)

Source from the content-addressed store, hash-verified

88
89/** One JSON-RPC error shape, or null when the body is not the protocol envelope. */
90const jsonRpcError = (body: string): { readonly code: number; readonly message: string } | null => {
91 // oxlint-disable-next-line executor/no-try-catch-or-throw -- test helper: a non-JSON body is itself the signal we assert on
92 try {
93 const parsed = JSON.parse(body) as {
94 readonly jsonrpc?: string;
95 readonly error?: { readonly code?: number; readonly message?: string };
96 };
97 if (parsed.jsonrpc !== "2.0" || typeof parsed.error?.code !== "number") return null;
98 return { code: parsed.error.code, message: parsed.error.message ?? "" };
99 } catch {
100 return null;
101 }
102};
103
104/**
105 * The verdict a request gets once the destroy alarm has wiped the session's

Callers 2

isWipedVerdictFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected