Releases: dtolnay/thiserror
Releases · dtolnay/thiserror
1.0.29
-
Support error types containing generic type parameters (#148, #149, #150, #151)
use thiserror::Error; #[derive(Error, Debug)] pub enum MyError<E, F, G> { #[error("thing {0} ({0:?})")] Variant(E), #[error("some error")] Delegate(#[source] SomeError<F>), #[error("err 0o{val:o}")] Octal { val: G }, }
In the above example, thiserror would automatically generate the following pair of generic trait impls.
impl<E, F, G> std::error::Error for MyError<E, F, G> where SomeError<F>: std::error::Error + 'static, Self: std::fmt::Debug + std::fmt::Display; impl<E, F, G> std::fmt::Display for MyError<E, F, G> where E: std::fmt::Debug + std::fmt::Display, G: std::fmt::Octal;
1.0.28
1.0.27
1.0.26
1.0.25
1.0.24
- Hygiene fixes in generated
source
method of error types originating inside of a macro definition to unblock rust-lang/rust#80689 (comment) (#121, thanks @Aaron1011)
1.0.23
1.0.22
1.0.21
-
Support capturing backtraces inside of Arc from a From impl, which makes it possible for errors having backtraces to be clonable (#102)
use std::backtrace::Backtrace; use std::sync::Arc; use thiserror::Error; #[derive(Error, Debug, Clone)] #[error("...")] pub struct ClonableErrorWithBacktrace { #[from] source: Inner, #[backtrace] backtrace: Arc<Backtrace>, }