effect-io-ai

Package: effect
Module: Effect

Effect.fail

Creates an Effect that represents a recoverable error.

When to Use

Use this function to explicitly signal an error in an Effect. The error will keep propagating unless it is handled. You can handle the error with functions like catchAll or catchTag.

Example (Creating a Failed Effect)

import { Effect } from "effect"

//      ┌─── Effect<never, Error, never>
//      ▼
const failure = Effect.fail(
  new Error("Operation failed due to network error")
)

See

Signature

declare const fail: <E>(error: E) => Effect<never, E>

Source

Since v2.0.0