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

Function serializeJson

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

Source from the content-addressed store, hash-verified

92};
93
94const serializeJson = (value: unknown, label: string): string | undefined => {
95 if (typeof value === "undefined") {
96 return undefined;
97 }
98
99 try {
100 return JSON.stringify(value);
101 } catch (cause) {
102 throw new Error(`${label} is not JSON serializable: ${toError(cause).message}`);
103 }
104};
105
106const looksLikeInterruptedError = (message: string): boolean => /\binterrupted\b/i.test(message);
107

Callers 1

createToolBridgeFunction · 0.85

Calls 1

toErrorFunction · 0.70

Tested by

no test coverage detected