However, I would like to explore the example code a bit. I started this thread with the intention of talking about catching explicit exceptions contrasted with catching general exceptions. Checked vs Unchecked, although related, is a bit of a side track.
Consider code snippet you shared...
try\n{\n...get data from user or whatever.\ncallBusinessLayerA(...);\ncallBusinessLayerB(...);\n...use data from business layer to setup view or whatever.\n}\ncatch ( ApplicationException e )\n{\n..set up error messages to display error from business layer...\n}I assume the purpose of the catch clause is to catch the non-fatal failure modes of the try block and to report those failures in user in some fashion (e.g. log them, or an error dialog).
If that is the case, why wouldn't you catch Exceptions rather than ApplicationException. After all, failing because of a null pointer is just as much of a failure as anything else and I would expect all failures to be handled consistently.
I understand catching a specific exception in order to provide specific logic for a certain kind of failure, but ApplicationException seems to be too general for that purpose.
Thanks for the time and effort you have spent on this discussion.