Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AsErrorSource for error sources that don't implement std::error::Error #103

Open
iliana opened this issue Jul 1, 2019 · 3 comments
Labels
enhancement New feature or request found in the field A user of SNAFU found this when trying to use it help wanted Extra attention is needed

Comments

@iliana
Copy link

iliana commented Jul 1, 2019

Since starting to use SNAFU I've repeatedly run into libraries whose error types implement Debug + Display but not std::error::Error.

Two options I can think of that might make this easier to deal with for users:

  • failure has a Compat struct which can just wrap the type, and implements Error if the underlying type implements Debug + Display. (I've been writing types like this as a workaround in my projects.)
  • Add implementations of AsErrorSource for dyn Debug + Display + 'static, etc.
@shepmaster shepmaster added enhancement New feature or request found in the field A user of SNAFU found this when trying to use it help wanted Extra attention is needed labels Jul 3, 2019
@shepmaster
Copy link
Owner

Hmm. This feels like it could be similar to #99, another place where AsErrorSource isn’t valid (due to ’static).

There, I proposed being able to effectively disable the Error::source method, which should also allow this case to work.

Can you see any downsides to disabling it in your cases?

@iliana
Copy link
Author

iliana commented Jul 3, 2019

I think that sounds like it could work, yes. I don't see any downsides for my particular use cases.

@shepmaster
Copy link
Owner

See also #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request found in the field A user of SNAFU found this when trying to use it help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants