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

Consider generalizing Errors so that it also works for more constrained throwers #10

Open
oliviercailloux opened this issue May 15, 2020 · 3 comments

Comments

@oliviercailloux
Copy link

Unless I missed something, Errors currently is used to wrap all throwables. It would be useful to be able to use Errors (or a generalized version of it, say, SpecificErrors) to wrap interfaces which throw only one checked exception, for example, IOException. Thus, SpecificErrors would be a generic type, with a type parameter <E> which designates the kind of throwable to be wrapped. Any other unchecked exception thrown by the wrappers created by SpecificErrors would be left alone and thrown as-is.

@nedtwigg
Copy link
Member

It's been a long time, but I have a hazy memory that template type inference didn't work like I expected when I tried it. Would be happy to look at a PR which explores this. I'm very busy atm, can't promise a fast turnaround time.

@oliviercailloux
Copy link
Author

Related to this issue and #8, I’d like to mention that I just released a few classes, inspired by durian’s “error” classes, which implement what I was thinking about (more strictly typed, with no duplication of Guava, and IMHO slightly simpler to use and understand).

Any comments would be much appreciated.

https://github.com/oliviercailloux/JARiS

@nedtwigg
Copy link
Member

Congratulations! Looks like this issue is resolved, but I'll keep it open indefinitely to advertise your project. For now I still don't understand the need for SpecificErrors, but the great thing about open source is that you don't need convince me :D

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

No branches or pull requests

2 participants