Crate app_error

Crate app_error 

Source
Expand description

App errors

This crate provides an error type, AppError, that is intended for usage in applications.

It is Send, Sync, 'static, and, importantly, cheaply Clone-able.

To achieve this, it serializes every error it receives without owning it, meaning that you also can’t retrieve the error later by downcasting it.

It is also able to store multiple errors at once and provide pretty-printing of all of these them.

It can carry an optional data parameter that may be retrieved later on.

The inner representation is similar to AppError = (String, Option<AppError>) | Vec<AppError>.

Macros§

app_error
A macro that formats and creates an AppError
bail
A macro that returns an error
ensure
A macro that returns an error if a condition is false

Structs§

AppError
A reference-counted untyped error that can be created from any error type.
DataIter
Data iterator
PrettyDisplay
Pretty display for AppError

Enums§

AllErrs
Helper type to collect a IntoIter<Item = Result<T, AppError>> into a Result<C, AppError> with all of the errors instead of the first.

Traits§

Context
Context for Result-like types