Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Allow multiple errors to be mapped to single local error #235

Open
thegranddesign opened this issue Oct 23, 2017 · 2 comments
Open

Allow multiple errors to be mapped to single local error #235

thegranddesign opened this issue Oct 23, 2017 · 2 comments

Comments

@thegranddesign
Copy link

thegranddesign commented Oct 23, 2017

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);
}
@Yamakaky
Copy link
Contributor

Yeah, it's not possible for now because UrlParseError must contain an enum with the two variants.

@Lymia
Copy link

Lymia commented Oct 28, 2017

You could make a variant in errors { }, and manually write From implementations, maybe? I did that with std::sync::PoisonError (for different reasons)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants