Fail<E>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"
}Source effect/Cause.ts:3633 lines
export interface interface Fail<out E>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"
}
Fail<out function (type parameter) E in Fail<out E>E> extends Cause.interface Cause<out E>.ReasonProto<Tag extends string>Base interface shared by all reason types (Fail, Die, Interrupt).
Details
Every reason carries:
_tag — discriminant string ("Fail", "Die", or "Interrupt")
annotations — tracing metadata attached by the runtime
annotate() — returns a copy with additional annotations
ReasonProto<"Fail"> {
readonly Fail<out E>.error: out Eerror: function (type parameter) E in Fail<out E>E
}Referenced by 6 symbols