Hyperlinkv0.8.0-beta.28

Cause

Cause.Failinterfaceeffect/Cause.ts:363
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 Fail<out E> extends Cause.ReasonProto<"Fail"> {
  readonly error: E
}
Referenced by 6 symbols