Package: effect
Module: Channel
Constructs a channel that fails immediately with the specified lazily
evaluated Cause.
Example (Failing with lazy causes)
import { Cause, Channel } from "effect"
// Create a channel that fails with a lazily computed cause
let attempts = 0
const failedChannel = Channel.failCauseSync(() => {
attempts += 1
return Cause.fail(`Runtime error after attempt ${attempts}`)
})
// Create a channel with die cause computation
const dieCauseChannel = Channel.failCauseSync(() => {
const operation = "load-profile"
return Cause.die(`Unexpected defect during ${operation}`)
})
Signature
declare const failCauseSync: <E>(evaluate: LazyArg<Cause.Cause<E>>) => Channel<never, E, never>
Since v2.0.0