Hyperlinkv0.8.0-beta.28

Channel

Channel.dieconsteffect/Channel.ts:1075
(defect: unknown): Channel<never, never, never>

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"
})
constructors
export const die = (defect: unknown): Channel<never, never, never> => failCause(Cause.die(defect))
Referenced by 2 symbols