This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
It is not necessary to extend from exception but a good programing practice. If you look at the Exception hierarchy it has a parallel to Error which is child of throwable.
More generally in application you create your own exception hierarchies.
Edward Chen wrote:
We usually extend Exception instead of Throwable. Why? In what situations we extend Throwable.
Never extends throwable, extends Exception or an existing subclass of Exception as you want to add another kind of Exception not a kind of Throwable. You can extends RuntimeException if you need your exception to be unchecked.
As you can see the specs throwable has 2 child hierarchies namely error and exception. Error are "serious" errors that a program generally shouldn't expect to catch and recover from while Exceptions are errors that a program can reasonably recover from.
Hence we should try to use Exceptions in all our applications.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: why extend Exception instead of Throwable ?