MCPcopy Create free account
hub / github.com/Kevin7Qi/codex-collab / captureErrorMessage

Function captureErrorMessage

src/client.test.ts:16–28  ·  view source on GitHub ↗
(promise: Promise<unknown>)

Source from the content-addressed store, hash-verified

14 const msg: Record<string, unknown> = { id, method };
15 if (params !== undefined) msg.params = params;
16 return { line: JSON.stringify(msg) + "\n", id };
17}
18
19async function captureErrorMessage(promise: Promise<unknown>): Promise<string> {
20 // Workaround: bun test on Windows doesn't flush .rejects properly, so we
21 // capture the rejection message manually instead of using .rejects.toThrow().
22 let resolved = false;
23 try {
24 await promise;
25 resolved = true;
26 } catch (e) {
27 return e instanceof Error ? e.message : String(e);
28 }
29 if (resolved) throw new Error("Expected promise to reject, but it resolved");
30 return ""; // unreachable
31}

Callers 1

client.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected