( eff: Effect.Effect<A, Cause.YieldableError, R>, )
| 126 | const isInternalError = Schema.is(InternalError); |
| 127 | |
| 128 | export const captureEngineError = <A, R>( |
| 129 | eff: Effect.Effect<A, Cause.YieldableError, R>, |
| 130 | ): Effect.Effect<A, InternalError, R> => |
| 131 | eff.pipe( |
| 132 | Effect.catch((err) => |
| 133 | isInternalError(err) |
| 134 | ? Effect.fail(err) |
| 135 | : resolveCapture.pipe( |
| 136 | Effect.flatMap((c) => c.captureException(Cause.fail(err))), |
| 137 | Effect.flatMap((traceId) => Effect.fail(new InternalError({ traceId }))), |
| 138 | ), |
| 139 | ), |
| 140 | ); |
| 141 | |
| 142 | /** |
| 143 | * Edge defect catchall. Builds an `HttpApiBuilder.middleware` layer |
no outgoing calls
no test coverage detected