effect-io-ai

Package: effect
Module: Cause

Cause.Interrupt

A fiber interruption signal, optionally carrying the ID of the fiber that initiated the interruption.

Details

Use isInterruptReason to narrow a Reason to this type.

Example (Accessing the fiber ID)

import { Cause } from "effect"

const cause = Cause.interrupt(123)
const reason = cause.reasons[0]
if (Cause.isInterruptReason(reason)) {
  console.log(reason.fiberId) // 123
}

Signature

export interface Interrupt extends Cause.ReasonProto<"Interrupt"> {
  readonly fiberId: number | undefined
}

Source

Since v2.0.0