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

Why doesn't Error impl Fail? #151

Open
radix opened this issue Feb 5, 2018 · 3 comments
Open

Why doesn't Error impl Fail? #151

radix opened this issue Feb 5, 2018 · 3 comments

Comments

@radix
Copy link

radix commented Feb 5, 2018

Hi, I'm trying to integrate the failure crate a bit more tightly into a web framework, so that handlers can return Result<_, failure::Error> directly.

This web framework has a trait ResponseError: failure::Fail, and it requires web handlers to return Result<_, E> where E: ResponseError.

I was trying to impl ResponseError for failure::Error, but quickly realized I can't because failure::Error doesn't impl failure::Fail. Given that Error seems to support all of the same behavior that Fail requires, why doesn't it implement that trait?

@radix radix changed the title Why doesn't Error impl Fail? Why doesn't Error impl Fail? Feb 5, 2018
@Ixrec
Copy link

Ixrec commented Feb 5, 2018

https://github.com/withoutboats/failure/issues/99#issuecomment-348674144

It would be incoherent because of the reflexive impl of From<T> for T and the impl of From<F> For Error where F: Fail.


Meta: Would it make sense to add an FAQ to the Failure docs?

@radix
Copy link
Author

radix commented Feb 5, 2018

Ah, okay. Would this be possible with specialization?

I think a good place for a note would be in the documentation for Error, both library and in the guide.

@jimblandy
Copy link

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