effect-io-ai

Package: effect
Module: Cause

Cause.findDie

Returns a Result whose success value is the first Die reason in the cause, including its annotations. If the cause has no Die reason, the failure value is the original cause.

When to use

Use when you need the full Die reason from a Cause, including annotations.

Example (Extracting the first Die reason)

import { Cause, Result } from "effect"

const result = Cause.findDie(Cause.die("defect"))
if (!Result.isFailure(result)) {
  console.log(result.success.defect) // "defect"
}

See

Signature

declare const findDie: <E>(self: Cause<E>) => Result.Result<Die, Cause<E>>

Source

Since v4.0.0