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

Function observabilityMiddleware

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

Source from the content-addressed store, hash-verified

148) {}
149
150export const observabilityMiddleware = <Id extends string, Groups extends HttpApiGroup.Any>(
151 _api: HttpApi.HttpApi<Id, Groups>,
152): Layer.Layer<ObservabilityMiddleware> =>
153 Layer.succeed(ObservabilityMiddleware, (httpApp) =>
154 Effect.catchCause(httpApp, (cause) =>
155 Effect.gen(function* () {
156 const defect = Cause.findDefect(cause);
157 if (Result.isFailure(defect)) {
158 return yield* Effect.failCause(cause);
159 }
160 const c = yield* resolveCapture;
161 const traceId = yield* c.captureException(cause);
162 return HttpServerResponse.jsonUnsafe(new InternalError({ traceId }), {
163 status: 500,
164 });
165 }),
166 ),
167 );

Callers 7

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