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

Try.of() shouldn't soften exceptions by changing exception category for rethrown (fatal) exceptions #1964

Closed
nfekete opened this issue Apr 25, 2017 · 3 comments

Comments

@nfekete
Copy link
Member

nfekete commented Apr 25, 2017

Try.of() currently catches all exceptions and rethrows them if fatal in a wrapper exception. The wrapper for fatal exceptions is javaslang.control.Try.FatalException, which extends java.lang.RuntimeException, this way it changes exception categories and softens Errors (possibly java.lang.VirtualMachineError and subclasses) to RuntimeExceptions.

@nfekete nfekete changed the title Try.of() shouldn't soften exceptions by change exception class for rethrown (fatal) exceptions Try.of() shouldn't soften exceptions by changing exception category for rethrown (fatal) exceptions Apr 25, 2017
@nfekete
Copy link
Member Author

nfekete commented Apr 25, 2017

See for example google guava introduced ExecutionError as a counterpart of JDK's ExecutionException to wrap Errors to keep the semantics of the exception type categories. Also UncheckedExecutionException for wrapping RuntimeException.

@danieldietrich
Copy link
Contributor

I thought you meant including 'NotImplementedError' into the set of fatal exceptions when you said to create a ticket for Try.Fatal :)

This issue will be solved when we solve #1722.

@nfekete
Copy link
Member Author

nfekete commented Apr 25, 2017

No, why would I want to make it fatal? I was arguing for great lengths to make TODO() use a softer exception, not a more severe one :)

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