2 unstable releases
Uses old Rust 2015
0.2.0 | Jan 14, 2024 |
---|---|
0.1.0 | Dec 12, 2023 |
#2304 in Rust patterns
7KB
AppErr
A very thin Any
wrapper which does nothing more than state its intended
use-case.
lib.rs
:
AppErr is a wrapper object intended to hold application-specific errors.
The archetypal use-case is to allow applications that call library runtimes which call application callbacks to allow the application callbacks to return application-specific errors back to itself through the runtime.
In order to lessen the risk of wrapping an unintended type, the AppErr
constructor only take in types that implement apperr::Blessed
(which is a subtrait of std::error::Error
).
Alternatives
There are other ways to solve the same problem, but they are not always feasible.
- Traits can use associated types to declare the application-specific error types.
- A generic parameter can be used to declare the application-specific error type.
- Global variables can be used to store error information.