mini-effect
    Preparing search index...

    Function fail

    • Creates an Effect that immediately fails with the given cause.

      Type Parameters

      • C

        The error type

      Parameters

      • cause: C

        The error value to throw when the effect is executed

      Returns Effect<never, C, never, never>

      An Effect that always fails with cause

      When run, this effect throws the provided cause as an error. It is commonly used with tagged errors and inside catchSome or catchTags recovery handlers to re-throw or replace errors.

      import { fail, run } from "mini-effect";

      const failed = fail(new Error("something went wrong"));

      await run(failed); // throws Error("something went wrong")