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

Function serializeJson

packages/kernel/runtime-quickjs/src/index.ts:114–124  ·  view source on GitHub ↗
(value: unknown, label: string)

Source from the content-addressed store, hash-verified

112};
113
114const serializeJson = (value: unknown, label: string): string | undefined => {
115 if (typeof value === "undefined") {
116 return undefined;
117 }
118
119 try {
120 return JSON.stringify(value);
121 } catch (cause) {
122 throw new Error(`${label} is not JSON serializable: ${toError(cause).message}`);
123 }
124};
125
126const looksLikeInterruptedError = (message: string): boolean => /\binterrupted\b/i.test(message);
127

Callers 1

createToolBridgeFunction · 0.85

Calls 1

toErrorFunction · 0.70

Tested by

no test coverage detected