An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error, though a "normal" condition, is also a subclass of Error because most applications should not try to catch it.
A method is not required to declare in its throws clause any subclasses of Error that might be thrown during the execution of the method but not caught, since these errors are abnormal conditions that should never occur.
There are all sorts of reasons. Application-specific exceptions can be used to encapsulate and/or encapsulate underlying framework exceptions, providing an easy way to apply declarative exception handling in a robust way, even if the underlying exceptions change. Application-specific exceptions can provide application-specific information in the exception (like a user ID, etc.)
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32627
4
posted
0
It is obvious why we need application-specific Exceptions, but they are asking about Errors here.