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

Function makeRecorder

packages/core/api/src/observability.test.ts:16–27  ·  view source on GitHub ↗
(traceId = "trace-xyz")

Source from the content-addressed store, hash-verified

14// Recording ErrorCapture — returns a fixed trace id and accumulates
15// every cause it sees in a Ref.
16const makeRecorder = (traceId = "trace-xyz") =>
17 Effect.gen(function* () {
18 const seen = yield* Ref.make<ReadonlyArray<Cause.Cause<unknown>>>([]);
19 const layer = Layer.succeed(
20 ErrorCapture,
21 ErrorCapture.of({
22 captureException: (cause) =>
23 Ref.update(seen, (prev) => [...prev, cause]).pipe(Effect.as(traceId)),
24 }),
25 );
26 return { layer, seen };
27 });
28
29describe("capture", () => {
30 it.effect("translates StorageError to InternalError with ErrorCapture trace id", () =>

Callers 1

Calls 1

updateMethod · 0.65

Tested by

no test coverage detected