Wednesday, March 28, 2012

"Catch the exception" - syndrome

Two exception handling behavior of developers annoys me time & again,

1. No Exception  propagation - Catch the exception & say e.printStackTrace(), irrespective of the depth of the call ().
2. Suppress the exception at the inner most methods & return null.

Most of this mistake occurs project over project, irrespective of the amount of experience a developer has. I felt this happens because of 2 reasons, 

1. Not understanding the way the java exception stack trace is build & the critical importance of exception propagation.
2. Messy, meaningless compile time exception :) over Run-time exception (Obviously this is a bigger topic to debate).




No comments: