Hyperlinkv0.8.0-beta.28

Cause

Cause.Dieinterfaceeffect/Cause.ts:328
Die

An untyped defect — typically a programming error or an uncaught exception.

When to use

Use when inspecting Cause reasons that represent defects instead of typed failures or interruptions.

Details

The defect property is unknown because defects are not part of the typed error channel. Use isDieReason to narrow a Reason to this type.

Example (Accessing the defect)

import { Cause } from "effect"

const cause = Cause.die("Unexpected")
const reason = cause.reasons[0]
if (Cause.isDieReason(reason)) {
  console.log(reason.defect) // "Unexpected"
}
Source effect/Cause.ts:3283 lines
export interface Die extends Cause.ReasonProto<"Die"> {
  readonly defect: unknown
}
Referenced by 5 symbols