Package: effect
Module: Cause
Returns a Result whose success value is the first defect value from a
Die reason in the cause. If the cause has no Die reason, the
failure value is the original cause.
When to use
Use when you need the first defect value from a Cause as a Result,
without the full Die reason.
Example (Extracting the first defect)
import { Cause, Result } from "effect"
const result = Cause.findDefect(Cause.die("defect"))
if (!Result.isFailure(result)) {
console.log(result.success) // "defect"
}
See
findDie — extract the full Die reasonfindError — extract the first typed errorSignature
declare const findDefect: <E>(self: Cause<E>) => Result.Result<unknown, Cause<E>>
Since v4.0.0