variable / @typed/async-data

failure

Creates a failed state while preserving the complete Effect Cause.

Package version
1.0.0-beta.13
Category
State construction
Since
1.0.0

Import

import { failure } from "@typed/async-data";

Signatures

export declare const failure: <E>(cause: Cause.Cause<E>, progress?: Progress) => Failure<E>;

Why

Accepting Cause prevents typed failures, defects, and interruption from being collapsed into one error value.

Ownership and lifetime

This pure function acquires no resources; the returned wrapper retains the supplied persistent Cause.

Examples

import { failure } from "@typed/async-data"
import { Cause } from "effect"
const state = failure(Cause.fail("offline"))

Source