effect-io-ai

Package: effect
Module: Exit

Exit.isFailure

Checks whether an Exit is a Failure.

When to use

Use as a type guard to narrow Exit<A, E> to Failure<A, E> and access the cause property.

Example (Narrowing to failure)

import { Exit } from "effect"

const exit = Exit.fail("error")

if (Exit.isFailure(exit)) {
  console.log(exit.cause)
}

See

Signature

declare const isFailure: <A, E>(self: Exit<A, E>) => self is Failure<A, E>

Source

Since v2.0.0