Wednesday, September 24, 2014

EJ-65 Don't Ignore Exceptions

Ref: Effective Java by Joshua Bloch

I think, this is the most important advice related with exceptions, which might cause to put your hands around your head for hours while debugging a problem otherwise.

An empty catch block defeats the purpose of exception. Whenever you see an empty catch block, alarm bells should go off in your head. At the very least, the catch block should contain a comment explaining whit it is appropriate to ignore the exception.

No comments: