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

Function observabilityMiddleware

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

Source from the content-addressed store, hash-verified

167) {}
168
169export const observabilityMiddleware = <Id extends string, Groups extends HttpApiGroup.Any>(
170 _api: HttpApi.HttpApi<Id, Groups>,
171): Layer.Layer<ObservabilityMiddleware> =>
172 Layer.succeed(ObservabilityMiddleware, (httpApp) =>
173 Effect.catchCause(httpApp, (cause) =>
174 Effect.gen(function* () {
175 const defect = Cause.findDefect(cause);
176 if (Result.isFailure(defect)) {
177 return yield* Effect.failCause(cause);
178 }
179 const c = yield* resolveCapture;
180 const traceId = yield* c.captureException(cause);
181 return HttpServerResponse.jsonUnsafe(new InternalError({ traceId }), {
182 status: 500,
183 });
184 }),
185 ),
186 );

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