The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 An Introduction to Java Persistence for Client-Side Developers
Subject:  Isn't catch(Exception ex) bad?
Date:  2006-05-26 19:45:53
From:  joshy
Response to: Isn't catch(Exception ex) bad?


Well, yes and no. Realistically what can the application do at this point if persistence fails? Whether it's a DB/persistence exception or something general like a null pointer exception the app will pretty much do the same thing. I think it's probably best to throw a new exception (wrapping the old one) that the app can handle in some what that makes sense to the user. If the app really can do something different depending on the error then it can still check the wrapped exception. If not it can print a message to the user explaining what happened.

 Feed java.net RSS Feeds