Hyperlinkv0.8.0-beta.28

Exit

Exit.dieconsteffect/Exit.ts:314
(defect: unknown): Exit<never>

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
constructorsfailhasDies
Source effect/Exit.ts:3141 lines
export const die: (defect: unknown) => Exit<never> = core.exitDie