Hyperlinkv0.8.0-beta.28

Exit

Exit.getCauseconsteffect/Exit.ts:1049
<A, E>(self: Exit<A, E>): Option<Cause.Cause<E>>

Returns the Cause of a failed Exit as an Option.

When to use

Use when you need the failure Cause from an Exit as an Option instead of pattern matching.

Details

Returns Option.some(cause) for a Failure and Option.none() for a Success.

Example (Getting the failure cause)

import { Exit } from "effect"

console.log(Exit.getCause(Exit.fail("err"))) // { _tag: "Some", value: ... }
console.log(Exit.getCause(Exit.succeed(42))) // { _tag: "None" }
Source effect/Exit.ts:10491 lines
export const getCause: <A, E>(self: Exit<A, E>) => Option<Cause.Cause<E>> = effect.exitGetCause