mini-effect
    Preparing search index...

    Variable UnknownErrorConst

    UnknownError: FailureConstructor<"UnknownError"> = ...

    A built-in tagged error class for wrapping unexpected or untyped errors.

    UnknownError is created via failure("UnknownError") and carries the tag "UnknownError". It is intended as a catch-all for errors that don't have a more specific tagged type. Use the cause option to wrap the original error value.

    Can be caught with catchTags using the "UnknownError" key.

    import { UnknownError, fn, pipe, catchTags, succeed, run } from "mini-effect";

    const risky = fn<string, InstanceType<typeof UnknownError>>((signal) => {
    try {
    return doSomethingRisky();
    } catch (cause) {
    throw new UnknownError({ cause });
    }
    });

    const result = await run(
    pipe(
    risky,
    catchTags({
    UnknownError: (e) => succeed(`Unexpected: ${e.cause}`),
    }),
    ),
    );