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

Function observabilityMiddleware

packages/core/api/src/observability.ts:161–178  ·  view source on GitHub ↗
(
  _api: HttpApi.HttpApi<Id, Groups>,
)

Source from the content-addressed store, hash-verified

159) {}
160
161export const observabilityMiddleware = <Id extends string, Groups extends HttpApiGroup.Any>(
162 _api: HttpApi.HttpApi<Id, Groups>,
163): Layer.Layer<ObservabilityMiddleware> =>
164 Layer.succeed(ObservabilityMiddleware, (httpApp) =>
165 Effect.catchCause(httpApp, (cause) =>
166 Effect.gen(function* () {
167 const defect = Cause.findDefect(cause);
168 if (Result.isFailure(defect)) {
169 return yield* Effect.failCause(cause);
170 }
171 const c = yield* resolveCapture;
172 const traceId = yield* c.captureException(cause);
173 return HttpServerResponse.jsonUnsafe(new InternalError({ traceId }), {
174 status: 500,
175 });
176 }),
177 ),
178 );

Callers 8

webHandlerForFunction · 0.90
webHandlerForFunction · 0.90
makeProtectedApiLayerFunction · 0.90
webHandlerForFunction · 0.90
webHandlerForFunction · 0.90
startHarnessFunction · 0.90
startHarnessFunction · 0.90

Calls

no outgoing calls

Tested by 6

webHandlerForFunction · 0.72
webHandlerForFunction · 0.72
webHandlerForFunction · 0.72
webHandlerForFunction · 0.72
startHarnessFunction · 0.72
startHarnessFunction · 0.72