This site is a great reference for what to do and what to avoid.
http://today.java.net/pub/a/today/2006/04/06/exception-handling-antipatterns.html
The most useful part: Antipatterns: what you really *shouldn't* do, and why. Here's an excerpt:
catch (NoSuchMethodException e) {
LOG.error("Blah", e);
throw e;
}
"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."
So true!!
I gotta get a me whole book of antipatterns....
No comments:
Post a Comment