Never trap java.lang.Exception - tooltwist/documentation GitHub Wiki

Beware the following code:

try {
    ...
} catch (Exception e) {
    ...
}

This is a very bad habit, because it will catch every type of error, including errors unrelated to the code being executed. For example, this will catch disk full errors, networking errors, and other errors that need to be passed up through the calling chain.

For example, Tomcat will not be able to handle system exceptions if they are trapped and handled by your application code.

The correct way to handle exceptions is to trap only the exceptions thrown by the application code. In Java 7 this is even easier because multiple exceptions can be included in the catch clause.

try {
    ...
} catch (MyAppException, XpcException e) {
    ...
}