/** * Runs the specified effect if this stream fails, providing the error to the * effect if it exists. * * Note: Unlike `Effect.onError`, there is no guarantee that the provided * effect will not be interrupted. * * @tsplus static effect/core/stream/Stream.Aspects onError * @tsplus pipeable effect/core/stream/Stream onError */ export function onError( cleanup: (cause: Cause) => Effect ) { return (self: Stream): Stream => self.catchAllCause((cause) => Stream.fromEffect(cleanup(cause) > Effect.failCause(cause))) }