Hyperlinkv0.8.0-beta.28

Exit

Exit.filterCauseconsteffect/Exit.ts:673
<A, E>(self: Exit<A, E>): Result.Result<Cause.Cause<E>, Success<A>>

Extracts the Cause from a failed Exit as a Result.

When to use

Use when composing Exit checks with Filter or other Result-based filtering APIs and you want the raw Cause rather than the Failure wrapper.

Details

Returns Result.succeed(cause) when the Exit is a Failure, or Result.fail(success) with the original Success otherwise.

Gotchas

This is not an Option accessor or an Effect failure. A failed extraction is represented as data in the Result failure channel.

Example (Filtering for the cause)

import { Exit, Result } from "effect"

const exit = Exit.fail("err")
const result = Exit.filterCause(exit)

console.log(Result.isSuccess(result)) // true
Source effect/Exit.ts:6731 lines
export const filterCause: <A, E>(self: Exit<A, E>) => Result.Result<Cause.Cause<E>, Success<A>> = effect.exitFilterCause