custom_error
custom_error copied to clipboard
Define custom errors without boilerplate using the custom_error! macro.
This issue is tangentially related to #30, but should hopefully be easier to decide and implement. Also CC #17 since that is the PR introducing enum structs. --- Currently the...
Something like this would be nice: ```rs custom_error!{pub Error EmptyCollection(&'static str) = "empty collection error: {0}", PackingFailed(&'static str) = "image packing error: {0}", } ```
After upgrading to 1.7.1, the compiler complained that `error[E0277]: the trait bound 'std::boxed::Box: std::borrow::Borrow' is not satisfied` I'm sure that it didn't occurred on `1.6.0` and `1.7.0`. But this version...
Currently, enum variants defined by `custom_error!` macro do not support attributes. ```rust custom_error! {pub FooError IO {source: std::io::Error} = "IO operations failed unexpectedly.", #[cfg(feature = "use-mpsc")] MpscRecv {source: std::sync::mpsc::RecvError} =...
It would be great to be able to specify bounds in generic errors. Something like: ```rust custom_error!{MyError Bad{param: T} = @{ param.to_string() }, } ```
I am not sure whether this is possible to do with the current implementation, but it would be nice to implement `Display` for error types even when they contain parameters...
If you have a module called core and you define it on the same level it does not work ``` pub mod core; use ::core::fmt; use custom_error::custom_error; custom_error! { pub...