Status
: AnError
container for Rust.
An Error
container lowers the overhead for reporting the status via Result<_, E>
.
Unlike the error-wrapping pattern found in cargo
and generalized in anyhow
, the pattern
implemented in Status
comes from some proprietary C++ projects which try to address the
following requirements:
- Programmatically respond to both the Kind
of status and the metadata, or Context
, of
the status.
- Dealing with error-sites not knowing enough to describe the error but allowing the
Context
to be built gradually when unwinding and a function has relevant information to
add.
- Localizing the rendered message.
- Allowing an application to make some phrasing native to its UX.
- Preserving all of this while passing through FFI, IPC, and RPC.
These requirements are addressed by trading off some usability due to having a more
cookie-cutter approach to error messages. The Kind
serves as a static description of the
error that comes from a general, fixed collection. Describing the exact problem and tailored
remediation is the responsibility of the Context
which is generally key-value pairs.
For more, see docs.rs/status.
Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.