Errors

Module errors

import errors

What to do with the reason inside an Err.

An error in Zirric is any value carrying the prelude.Error attribute, which knows how to render itself for diagnostics. errors works with those values rather than with prelude.Result itself.

join and wrap both return new @Error values whose debug output is composed from the errors they were given, so the context survives into whatever finally prints it.

Contents


Functions

debug

`errors/errors.zirr:4`
fn debug(err: @Error) -> String

Returns a debug string for err, via its @Error attribute.


join

`errors/errors.zirr:9`
fn join(errs: [@Error]) -> Option

Returns an @Error combining every error in errs, or None if errs is empty.


unwrap

`errors/errors.zirr:26`
fn unwrap(err: @Error) -> @Error

Returns the error wrap was called with, or err itself if it isn’t wrapped.


wrap

`errors/errors.zirr:21`
fn wrap(err: @Error, message: String) -> @Error

Returns an @Error that adds context to err, debugging as “: ”.