When I start to design a project, I also consinder the exception design. To build a effective exception I think about
work flow, user experience and performance. Here Jim Cushing wrote “Three Rules for Effective Exception Handling” said
“Exceptions in Java provide a consistent mechanism for identifying and responding to error conditions.
Effective exception handling will make your programs more robust and easier to debug.
Exceptions are a tremendous debugging aid because they help answer these three questions:
* What went wrong?
* Where did it go wrong?
* Why did it go wrong?
When exceptions are used effectively, what is answered by the type of exception thrown,
where is answered by the exception stack trace, and why is answered by the exception message.
If you find your exceptions aren’t answering all three questions, chances are they aren’t being used effectively.
Three rules will help you make the best use of exceptions when debugging your programs.
These rules are: be specific, throw early, and catch late.”
Ref:
Best Practices for Exception Handling”
Exception-Handling Antipatterns Exception-Handling Antipatterns
Best Practices in EJB Exception Handling
Best Practices for Exception Handling
When catching exceptions, don’t cast your net too wide






No comments yet
Comments feed for this article