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

Function serializeJson

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

Source from the content-addressed store, hash-verified

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

Callers 1

createToolBridgeFunction · 0.85

Calls 1

toErrorFunction · 0.70

Tested by

no test coverage detected