import { concreteStream, StreamInternal } from "@effect/core/stream/Stream/operations/_internal/StreamInternal" /** * Switches over to the stream produced by the provided function in case this * one fails. Allows recovery from all causes of failure, including * interruption if the stream is uninterruptible. * * @tsplus static effect/core/stream/Stream.Aspects catchAllCause * @tsplus pipeable effect/core/stream/Stream catchAllCause */ export function catchAllCause( f: (cause: Cause) => Stream ) { return (self: Stream): Stream => { concreteStream(self) return new StreamInternal( self.channel.catchAllCause((cause) => { const stream = f(cause) concreteStream(stream) return stream.channel }) ) } }