( eff: Effect.Effect<A, E, R>, )
| 91 | * through unchanged. |
| 92 | */ |
| 93 | export const capture = <A, E, R>( |
| 94 | eff: Effect.Effect<A, E, R>, |
| 95 | ): Effect.Effect<A, Exclude<E, StorageFailure> | InternalError, R> => |
| 96 | (eff as Effect.Effect<A, E | StorageFailure, R>).pipe( |
| 97 | // oxlint-disable-next-line executor/no-effect-escape-hatch -- boundary: unique conflicts that reach the HTTP edge are unexpected defects captured by observabilityMiddleware |
| 98 | Effect.catchTag("UniqueViolationError", (err) => Effect.die(err)), |
| 99 | Effect.catchTag("StorageError", (err) => |
| 100 | resolveCapture.pipe( |
| 101 | Effect.flatMap((c) => c.captureException(Cause.fail(err))), |
| 102 | Effect.flatMap((traceId) => Effect.fail(new InternalError({ traceId }))), |
| 103 | ), |
| 104 | ), |
| 105 | Effect.catchTag("StorageConnectionError", (err) => |
| 106 | resolveCapture.pipe( |
| 107 | Effect.flatMap((c) => c.captureException(Cause.fail(err))), |
| 108 | Effect.flatMap((traceId) => Effect.fail(new InternalError({ traceId }))), |
| 109 | ), |
| 110 | ), |
| 111 | ) as Effect.Effect<A, Exclude<E, StorageFailure> | InternalError, R>; |
| 112 | |
| 113 | /** |
| 114 | * Translate an engine/runtime-level `YieldableError` (CodeExecutionError, |
no outgoing calls
no test coverage detected