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

Function makeRecorder

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 1

updateMethod · 0.65

Tested by

no test coverage detected