effect-io-ai

Package: effect
Module: Cause

Cause.findInterrupt

Returns a Result whose success value is the first Interrupt reason in the cause, including its annotations. If the cause has no Interrupt reason, the failure value is the original cause.

When to use

Use when you need the first Interrupt reason from a Cause, including the fiber ID and annotations.

Example (Extracting the first interrupt)

import { Cause, Result } from "effect"

const result = Cause.findInterrupt(Cause.interrupt(42))
if (!Result.isFailure(result)) {
  console.log(result.success.fiberId) // 42
}

See

Signature

declare const findInterrupt: <E>(self: Cause<E>) => Result.Result<Interrupt, Cause<E>>

Source

Since v4.0.0