The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 Three Rules for Effective Exception Handling
Subject:  An endless war...
Date:  2003-12-12 06:01:06
From:  bitog
Response to: An endless war...


I agree on the violation of the "be specific" rule... but, if you don't write the bunch of instance of, you have to write a lot of "catch", I guess. At least, you could put the "bunch" on a UI-dependendent utility class.

In order to the double logging: the higher logger could be located in a different layer (a different log at all), so I have to log as quick as I can DB errors on the DAO layer log and UI errors (Illegal form parameters and so on) into another possible log.
In addition: when a lower RuntimeException is caught at an higher level, I'm not forced to log it, because I'm sure that it was already done. All that I want at the UI level, most of the time, is only to display an error message to the user.

It's great to talk with you on this argument .. ;)

 Feed java.net RSS Feeds