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

RuntimeException turned into Error #371

Open
arcuri82 opened this issue Aug 2, 2017 · 1 comment
Open

RuntimeException turned into Error #371

arcuri82 opened this issue Aug 2, 2017 · 1 comment

Comments

@arcuri82
Copy link

arcuri82 commented Aug 2, 2017

Hi,
I have a problem with Governator that is turning runtime exceptions (eg IAE/ISE due to misconfigurations in PostConstructs) into Errors (which usually should not be catch in a program). The issue seems lying in InternalLifecycleModule#onProvision, where there is:

try {  ...
 } catch (ExecutionException e) {
        // caching problem
       throw new RuntimeException(e);
  } catch (Throwable e) {
       // unknown problem will abort injector start up
       throw new Error(e);
  }

is that really the expected behaviour you want? If there is a need to catch Throwable, what about adding before it something like the following?

catch(RuntimeException e){
     throw e;
}
@arcuri82
Copy link
Author

arcuri82 commented Aug 2, 2017

sorry, a clarification: the issue is with a thrown InvocationTargetException (ITE), which extends Exception (not RuntimeException). So, when I call LifecycleInjector#createInjector there is no checked exception, but then runtime exceptions that lead to ITEs are masked into Error, which my main catch at the root of my application does not catch

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

No branches or pull requests

1 participant