Why catch Exceptions in Java, when you can catch Throwables?

Posted by corfield on Stack Overflow See other posts from Stack Overflow or by corfield
Published on 2009-02-24T14:11:16Z Indexed on 2010/03/24 7:13 UTC
Read the original article Hit count: 245

Filed under:

Hi

We recently had a problem with a Java server application where the application was throwing Errors which were not caught because Error is a separate subclass of Throwable and we were only catching Exceptions.

We solved the immediate problem by catching Throwables rather than Exceptions, but this got me thinking as to why you would ever want to catch Exceptions, rather than Throwables, because you would then miss the Errors.

So, why would you want to catch Exceptions, when you can catch Throwables?

© Stack Overflow or respective owner

Related posts about java