in reply to Re: Re: Enforcing exception catching
in thread Enforcing exception catching

Placing all top-level calls in try{} blocks seems to be fixing symptoms, not the problem.

It does only fix one symptom, but I never meant that to be a fix for the whole problem (sorry if i wasn't clear). IMO if you have code that throws an exception anywhere at all, your top level call should always have a catch block. You should never let an exception kill your program, you should always catch them so that you can clean up resources and such, or at a minimum log the exception and a stack trace.

Exceptions are a huge improvement over standard return value error checking not just because they allow you to centralize your error handling (sometimes much further up the call chain), but because they (the exception itself) can carry with it valuable information, like stack traces and contextual information from the call site. This kind of info is invaluable when trying to debug an error, and lightyears ahead of the old standard printf debugging technique.

-stvn