effect-io-ai

Package: effect
Module: Exit

Exit.die

Creates a failed Exit from a defect (unexpected error).

When to use

Use when you need unexpected, unrecoverable errors that should not appear in the typed error channel.

Details

The defect is wrapped in a Cause.Die internally.

Returns a Failure<never> with E = never, since defects do not appear in the typed error channel.

Example (Creating a defect Exit)

import { Exit } from "effect"

const exit = Exit.die(new Error("Unexpected error"))
console.log(Exit.isFailure(exit)) // true

See

Signature

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

Source

Since v2.0.0