thiserror-ext
Useful extension utilities for thiserror. See the documentation for more details.
// `thiserror_ext::Construct`
let error: Error = internal;
// `thiserror_ext::Box`
assert_eq!;
// You can access the backtrace through `backtrace()` method, or nightly-only `std::error::request_ref`.
let bt: &Backtrace = error.backtrace.unwrap;
let bt: &Backtrace = request_ref.unwrap;
// `thiserror_ext::ContextInto`
let result: = "foo".parse.into_parse;
// `thiserror_ext::AsReport`
//
// "cannot parse int from `foo`: invalid digit found in string"
println!;
// `thiserror_ext::Macro`
bail_not_implemented!;
Features
-
std(default): enablesstdintegration. In particular,#[thiserror_ext(newtype(.., backtrace))]captures backtraces and the generated newtype exposes.backtrace(). Disable default features forno_std+alloc:= { = "...", = false } -
nightly: enable nightly features ofError, especiallystd::error::Error::provide. This enables:-
forwarding provided members from generated newtypes;
-
backtrace de-duplication when source errors already provide one;
-
custom provide logic through
extra_provide:
-