ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Best Practices for Exception Handling
Subject:   Don't wrap exceptions!
Date:   2008-07-31 00:20:09
From:   kdgar
Response to: Don't wrap exceptions!

This is 100% correct.


Just to add to this argument (which is already well put), say your presentation layer catches only SQLExceptions. You then switch to a different type of data source like a web service. Your presentation will then be catching things that never happen. In fact, all your code may completely fail to compile.


Had you been catching a wrapped exception, like PersistenceException, you'd be in good shape.