/** * Runs the specified effect if this effect fails, providing the error to the * effect if it exists. The provided effect will not be interrupted. * * @tsplus static effect/core/io/Effect.Aspects onError * @tsplus pipeable effect/core/io/Effect onError */ export function onError( cleanup: (cause: Cause) => Effect ) { return (self: Effect): Effect => self.onExit( (exit): Effect => exit._tag === "Success" ? Effect.unit : cleanup(exit.cause) ) }