Ian Bicking: the old part of his blog

Re: Goodcatchallexceptions comment 000

Catching all exceptions is bad, because it shows that you do not know how your program works. 
Any exception IS predictable, we are talking computer programs, not random static.

Sometimes you need a program to crash or properly raise exceptions. Reraising only works if 
the clean-up action doesn't raise any exceptions, as discussed earlier.  Here's the deal, 
only catch exceptions that you except. If an exception you don't expect is raised that 
means you have a bug, you fix the bug and add the proper handling of that exception.

I've seen many Java programmers do

try {
} catch (Exception e) {
  System.err.println("Error occurred: " + e.getMessage());

and this sucks TREMENDOUSLY if you are trying to debug a program. Sometimes you want your 
program to crash and burn, just to let you know that something is really wrong.
Even user input is predictable enough to write exact error handling.
Catching all exception may cure the symptoms, but not the cause; fix the cause instead.

Finally, it might be OK to catch all exceptions if it is imperitive that your 
process/thread do not stop. In that case, try catching the exception at the highest 
possible level and log with full stacktrace and give as much debug input as possible.
However, on many systems bugs might just as well end the process and send the stacktrace 
to stderr. I've seen too many bad things happen with processes that should have been 
terminated due to bugs, but poor programming let the processes continue doing bad things 
to the rest of the system.
Comment on Goodcatchallexceptions comment 000
by Ian Bicking