Hyperlinkv0.8.0-beta.28

Cause

Cause.findDieconsteffect/Cause.ts:923
<E>(self: Cause<E>): Result.Result<Die, Cause<E>>

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"
}
Source effect/Cause.ts:9231 lines
export const findDie: <E>(self: Cause<E>) => Result.Result<Die, Cause<E>> = effect.findDie