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

Function parseJsonSafe

packages/plugins/mcp/src/sdk/http-status.ts:70–78  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

68const decodeSdkHttpErrorText = Schema.decodeUnknownOption(SdkHttpErrorText);
69
70const parseJsonSafe = (text: string): unknown => {
71 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: classifying an untrusted upstream error body; a parse failure just means "not a JSON body"
72 try {
73 // oxlint-disable-next-line executor/no-json-parse -- boundary: the parsed value is only structurally decoded for a message field, never used as domain data
74 return JSON.parse(text) as unknown;
75 } catch {
76 return undefined;
77 }
78};
79
80/** The caller-facing message from a JSON error body the SDK's HTTP error
81 * carries, or `undefined` when there is none. */

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected