error-chain
error-chain copied to clipboard
Allow multiple errors to be mapped to single local error
The reason I sought out this crate was because I wanted to do something like this:
::url::ParseError => ::my_crate::errors::UrlParseError
::hyper::errors::UriError => ::my_crate::errors::UrlParseError
Unfortunately it doesn't seem like that's currently possible with this crate.
Am I missing something? If not, can it be added?
I'm thinking syntax such as:
foreign_links {
UrlParseError(::url::ParseError, ::hyper::errors::UriError);
}
Yeah, it's not possible for now because UrlParseError must contain an enum with the two variants.
You could make a variant in errors { }
, and manually write From implementations, maybe? I did that with std::sync::PoisonError
(for different reasons)