|
Re: Exception-Handling Anti-Patterns
|
Posted: Apr 7, 2006 2:23 PM
|
|
First of all i think the article was extremly shallow. Not much detail and no real out of the box thinking. For example here is my pet "This is one of the most annoying error-handling antipatterns. Either log the exception, or throw it, but never do both. Logging and throwing results in multiple log messages for a single problem in the code, and makes life hell for the support engineer who is trying to dig through the logs."
TRUE, if you are really silly to log it again. For example, if this is an online application, Maybe you want to log the exception and wrap it with some generic exception to be sent to the ui layer and the generic message handling code inspects the exception and generates a message for the end user. Maybe you want to log it, wrap it and send the message to different component who is interested in why the request failed. Maybe Maybe ...... there are many scenarios, but the author makes it sounds like that the habit of log n rethrow is a sin
In my opinion rambling never helps.
Yes exception handling is not done nicely, but then propose a framework, propose pattens which developers can leverage. That to me is the key to this problem.
|
|