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