@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 18 lines 645 Bytes
Raw
1 import * as Cause from "effect/Cause";
2 import * as Effect from "effect/Effect";
3 import * as ErrorReporter from "effect/ErrorReporter";
4
5 // RpcServer reports typed failures too; log only defects.
6 const reporter: ErrorReporter.ErrorReporter = {
7 [ErrorReporter.TypeId]: ErrorReporter.TypeId,
8 report: ({ cause, fiber }) => {
9 for (const reason of cause.reasons) {
10 if (reason._tag !== "Die" || ErrorReporter.isIgnored(reason.defect)) continue;
11 Effect.runForkWith(fiber.context)(
12 Effect.logError("Unhandled defect", Cause.fromReasons([reason])),
13 );
14 }
15 },
16 };
17
18 export const layer = ErrorReporter.layer([reporter]);