Hyperlinkv0.8.0-beta.28

Cause

Cause.findFailconsteffect/Cause.ts:811
<E>(self: Cause<E>): Result.Result<Fail<E>, Cause<never>>

Returns a Result whose success value is the first Fail reason in the cause, including its annotations. If the cause has no Fail reason, the failure value is the original cause narrowed to Cause<never>, because it contains no typed error reasons.

When to use

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

Example (Extracting the first Fail reason)

import { Cause, Result } from "effect"

const result = Cause.findFail(Cause.fail("error"))
if (!Result.isFailure(result)) {
  console.log(result.success.error) // "error"
}
Source effect/Cause.ts:8111 lines
export const findFail: <E>(self: Cause<E>) => Result.Result<Fail<E>, Cause<never>> = effect.findFail