This is a follow up question to this one.
It seems to be generally accepted that doing a broad 'catch (Exception)' is a bad idea.
The reasoning is typically something like 'you must handle the exception properly' and 'catch what you can handle' and a few other generic sounding arguments.
Those generic answer sound reasonable, but they don't really satisfy me.
Let me be concrete. Here's a typical bit of code which is supposed to be 'bad'.
try {
... do something...
} catch (Exception e) {
log(e); //leave a trace for debugging
return ...a value the context can deal with...
}
A sceptical mind can remain unconvinced that not handling the exception, (which will probably blow up the entire program), is necessarily a better outcome than handling it in this generic way.
So I would really like some specific and convincing example(s), with code snippet(s), of something bad that actually happens because of a supposedly too broad catch clause like the one above.
PS: one could think about this question in other languages than Java, but since I want specific examples, this is really about specific Exceptions that might be raised by a Java program and JRE.
PS2: I am specifically interested in examples of Exception that are in fact a subtype of java.lang.Exception and not the more broadly 'Throwable'. So that rules out stuff like 'OutOfMemoryError' as valid examples.