1. Design your own Exception hierarchy to handle all categories of potential errors in your system
2. extend Exception class for your throwable error-handled classes
3. Throw your defined exception classes in your code block in necessary
4. Embed error information in your defined exception
5. if you develop with new Java, be noticed that Exception implements
serializable interface, you need define a static final variable for
serial version UID, otherwise, warn message will be given by new compiler.
here is a good article to talk about this issue.