// ets_tracing: off import type * as CS from "../../../../Cause/index.js" import type * as CK from "../../../../Collections/Immutable/Chunk/index.js" import * as CH from "../../Channel/index.js" import * as C from "../core.js" /** * 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. */ export function catchAllCause_( self: C.Stream, f: (cause: CS.Cause) => C.Stream ): C.Stream { const channel: CH.Channel< R & R1, unknown, unknown, unknown, E1, CK.Chunk, unknown > = CH.catchAllCause_(self.channel, (_) => f(_).channel) return new C.Stream(channel) } /** * 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. * * @ets_data_first catchAllCause_ */ export function catchAllCause( f: (cause: CS.Cause) => C.Stream ) { return (self: C.Stream) => catchAllCause_(self, f) }