thiserror
thiserror copied to clipboard
derive(Error) for struct and enum error types
closes #142 ```rust #[derive(Debug, Error)] struct MyError { #[from] err: SomeOtherError, #[location] /*optional attr*/ location: &'static Location
Sorry if this is a duplicate, or there are rustc limitations that I am missing, but when using the nightly `backtrace` feature, I only get the following when panicing ```...
For this sort of code today \[\]: ```rust #[error("{code}{}", match .message { Some(msg) => format!(" - {}", &msg), None => "".to_owned(), })] SungrowError { code: u16, message: Option }, ```...
```rust use thiserror::Error; #[derive(Error, Debug)] pub enum Error { #[error("system: {0}")] System(#[from] #[backtrace] anyhow::Error), } ``` Error ``` ⣿ Errors Exited with status 101 Standard Error Compiling playground v0.0.1 (/playground)...
Hello there It's sometime useful to simply trace the location of an error's origin, through nested callers and micro managed errors. Compared to already existing `Backtrace`, it might be more...
How can `strum::ParseError` be "not implemented" if it's part of "the following other types" that are implemented?: ```rust error[E0277]: `?` couldn't convert the error to `CustomError` --> src/operation.rs:107:47 | 107...
I am facing this situation: ```rust #[derive(Debug, Error)] pub enum Error { #[error( "{}{}{}", match .path { Some(ref path) => &path[..], None => "" }, match .path { Some(_) =>...
Hi all! This is mostly just to open a discussion and share an opinion, but I'm happy to try implementing the change as well if people are onboard. My current...
As `thiserror` is complementary to `anyhow`, and `anyhow` supports `{:#}` format, would be nice if `thiserror` errors supported it too. This way in codebases that mix `thiserror` and `anyhow` errors,...
I have a use case where this example from the README is exactly what I need: ```rust #[derive(Error, Debug)] pub enum MyError { Io { #[from] source: io::Error, backtrace: Backtrace,...