Package: effect
Module: Effect
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
succeed to create an effect that represents a successful value.Signature
declare const fail: <E>(error: E) => Effect<never, E>
Since v2.0.0