effect-io-ai

Package: effect
Module: Channel

Channel.die

Constructs a channel that fails immediately with the specified defect.

Example (Dying with defects)

import { Channel } from "effect"

// Create a channel that dies with a string defect
const diedChannel = Channel.die("Unrecoverable error")

// Create a channel that dies with an Error object
const errorDefect = Channel.die(new Error("System failure"))

// Die with any value as a defect
const objectDefect = Channel.die({
  code: "SYSTEM_FAILURE",
  details: "Critical system component failed"
})

Signature

declare const die: (defect: unknown) => Channel<never, never, never>

Source

Since v4.0.0