/** * Keeps some of the errors, and terminates the fiber with the rest, using * the specified function to convert the `E` into a `Throwable`. * * @tsplus static effect/core/stm/STM.Aspects refineOrDieWith * @tsplus pipeable effect/core/stm/STM refineOrDieWith */ export function refineOrDieWith( pf: (e: E) => Maybe, f: (e: E) => unknown ) { return (self: STM): STM => self.catchAll((e) => pf(e).fold( () => STM.dieSync(f(e)), (e1) => STM.fail(e1) ) ) }