Package: effect
Module: Cause
A typed, expected error produced by Effect.fail.
When to use
Use when inspecting Cause reasons that represent expected failures from the
typed error channel.
Details
The error property carries the typed value E. Use isFailReason
to narrow a Reason to this type.
Example (Accessing the error)
import { Cause } from "effect"
const cause = Cause.fail("Something went wrong")
const reason = cause.reasons[0]
if (Cause.isFailReason(reason)) {
console.log(reason.error) // "Something went wrong"
}
See
fail for constructing a cause with a single Fail reasonisFailReason for narrowing a Reason to FailSignature
export interface Fail<out E> extends Cause.ReasonProto<"Fail"> {
readonly error: E
}
Since v2.0.0