Hyperlinkv0.8.0-beta.28

Exit

Exit.failCauseconsteffect/Exit.ts:251
<E>(cause: Cause.Cause<E>): Exit<never, E>

Creates a failed Exit from a Cause.

When to use

Use when you already have a Cause<E> and want to wrap it in an Exit for advanced error handling where you need full control over the Cause structure.

Details

Returns a Failure<never, E>. If you only have an error value, use fail instead.

Example (Creating a failed Exit from a Cause)

import { Cause, Exit } from "effect"

const cause = Cause.fail("Something went wrong")
const exit = Exit.failCause(cause)
console.log(Exit.isFailure(exit)) // true
constructorsfaildie
Source effect/Exit.ts:2511 lines
export const failCause: <E>(cause: Cause.Cause<E>) => Exit<never, E> = core.exitFailCause
Referenced by 7 symbols