effect-io-ai

Package: effect
Module: Exit

Exit.Failure

A failed Exit containing a Cause.

When to use

Use when working with the failed branch of an Exit after narrowing with isFailure. Access the cause via the cause property after narrowing.

Details

The Cause<E> may contain typed errors, defects, or interruptions.

Example (Accessing the failure cause)

import { Exit } from "effect"

const failure = Exit.fail("something went wrong")

if (Exit.isFailure(failure)) {
  console.log(failure._tag) // "Failure"
  console.log(failure.cause) // Cause representing the error
}

See

Signature

export interface Failure<out A, out E> extends Exit.Proto<A, E> {
  readonly _tag: "Failure"
  readonly cause: Cause.Cause<E>
}

Source

Since v2.0.0