| Crates.io | errore |
| lib.rs | errore |
| version | 0.4.1 |
| created_at | 2024-10-27 09:37:21.886905+00 |
| updated_at | 2024-11-25 18:02:58.207371+00 |
| description | Library for error handling and tracing |
| homepage | |
| repository | https://github.com/jpramosi/errore |
| max_upload_size | |
| id | 1424438 |
| size | 227,917 |
This library provides a framework to handle and trace errors across modules and crates.
At the moment errore is in development and breaking changes are to be expected.
At first glance, errore its error definition looks quite similar to thiserror`s:
However, it is possible to extract additional information from the error, as shown in this sample error output:
Error: example_basic::account::Authentication
├─▶ <example_basic::auth::ReadPassword> Invalid email or password
│ ├╴ examples/basic/src/auth.rs:20:8
│ ╰╴ examples/basic/src/auth.rs:24:8
│
╰─▶ <example_basic::account::Authentication>
╰╴ examples/basic/src/account.rs:20:5
Trace records:
<example_basic::auth::ReadPassword> Invalid email or password at examples/basic/src/auth.rs:20:8
<example_basic::auth::ReadPassword> Invalid email or password at examples/basic/src/auth.rs:24:8
<example_basic::account::Authentication> Invalid email or password at examples/basic/src/account.rs:20:5
Error display:
example_basic::account::Authentication: Invalid email or password
at examples/basic/src/auth.rs:20:8
Error extraction with 'match':
OS error code 2: entity not found
Error extraction with 'get()':
OS error code 2: entity not found
The complete example can be seen here. For other examples please see here.
Tracing capability with rich metadata such as file location and line number without backtracemetadata and error conversionSubscriber
and Formatter interfaceExtensions at subscriberthiserror that allows to optionally
enable errore in public distributed libraries on stable rust.
exampleno-std support & wasmcompatibleResult instrumentation are required#from requires a trait implementation of std::error::Error for the typewhere keywordanyhow support (shouldn't be a problem if errore is used)thiserror should be used.
errore can be used as is. Errors can be declared on a per module basis or as one global type.
errore the various examples
can serve as a good foundationctor: Utilizes link_sections provided by the ctor and inventory
crates to offer a better implementation of the metadata and subscriber relevant code. The fallback implementation is based on lazy static variables.
This feature can be disabled at no-std projects on build failures.debug-no-std: Enables internal logging with the defmt crate to debug errore itself.debug-std: Enables internal logging with the log crate to debug errore itself.std: Enables standard library support. If the std feature is not enabled, the alloc crate is required.thiserror which is used as errore`s foundation