Navigation

Error

Error effect with contextual messages and multiple handler strategies.

collecting

error.collecting: handler that accumulates every error into state as a list of { message, context } and resumes computation with null.

Collecting error handler: accumulates errors in state as a list. Resumes computation with null so subsequent effects still execute. Use when you want all errors, not just the first.

State shape: list of { message, context }

raise

raise: send an error effect carrying a message and empty context; the handler decides whether to throw, collect, or recover.

raise : string -> Computation a

Raise an error. Returns a Computation that sends an "error" effect. The handler determines what happens: throw, collect, or recover.

raiseWith

raiseWith: raise an error with a context string; handlers can collect contexts to assemble stack-trace-style reports.

raiseWith : string -> string -> Computation a

Raise an error with context. The context string describes where in the computation the error occurred, enabling stack-trace-like error reports when used with the collecting handler.

result

error.result: handler that aborts with a tagged { _tag = "Error"; message; context; } value; uses the non-resumption protocol.

Result error handler: aborts computation with tagged Error value. Uses the non-resumption protocol to discard the continuation.

Returns { _tag = "Error"; message; context; } on error.

strict

error.strict: handler that throws on the first error via builtins.throw, prefixing context when present; halts evaluation immediately.

Strict error handler: throws on first error via builtins.throw. Use when errors should halt evaluation immediately.

Includes context in the thrown message when available.