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:   2003-11-27 05:39:31
From:   anonymous2
Response to: Don't wrap exceptions!

"This decision should NEVER be made by any library code because it shifts too much knowledge of a process into the client code; this in term severely limits reusability."


But it should *also* not be done by your business code - business code shouldn't know about SQL at all!


So, what you need is a persistence layer, specific to your application. If that layer decides that the Exception can't be handled reasonably, it's a good thing to wrap the original SqlException into a more generic PersistenceException or something.


1 to 1 of 1
1 to 1 of 1