MCPcopy Create free account
hub / github.com/cloudflare/computer / #wrapHandle

Method #wrapHandle

packages/computer/src/workspace.ts:1104–1123  ·  view source on GitHub ↗
(id: string, dispatchHandle: BackendHandle, execHandle: unknown)

Source from the content-addressed store, hash-verified

1102 // ReadableStream directly are unaffected; only result() routes
1103 // through the invalidation path.
1104 #wrapHandle(id: string, dispatchHandle: BackendHandle, execHandle: unknown): unknown {
1105 const original = execHandle as { result?: unknown };
1106 if (typeof original.result !== "function") return execHandle;
1107 const onError = this.#onError;
1108 const originalResult = original.result.bind(execHandle) as () => Promise<unknown>;
1109 Object.defineProperty(execHandle, "result", {
1110 value: async () => {
1111 try {
1112 return await originalResult();
1113 } catch (error) {
1114 onError(id, dispatchHandle, error);
1115 throw error;
1116 }
1117 },
1118 enumerable: false,
1119 writable: false,
1120 configurable: true,
1121 });
1122 return execHandle;
1123 }
1124}
1125
1126export function createThinkCompatibility(

Callers 2

execMethod · 0.95
getMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected