effect-io-ai

Package: effect
Module: Exit

Exit.getCause

Returns the Cause of a failed Exit as an Option.

When to use

Use when you need the failure Cause from an Exit as an Option instead of pattern matching.

Details

Returns Option.some(cause) for a Failure and Option.none() for a Success.

Example (Getting the failure cause)

import { Exit } from "effect"

console.log(Exit.getCause(Exit.fail("err"))) // { _tag: "Some", value: ... }
console.log(Exit.getCause(Exit.succeed(42))) // { _tag: "None" }

See

Signature

declare const getCause: <A, E>(self: Exit<A, E>) => Option<Cause.Cause<E>>

Source

Since v4.0.0