What? Perhaps in some programming languages, but catching exceptions globally in C# works just fine.
> Just log all uncaught exceptions in something like Sentry, or a file for that matter, via a global exception handler.
(And in before "just swallow it" - nope. I've frequently found bugs by monitoring non-fatal exceptions).
I agree though that catching, logging and then immediately rethrowing exceptions is redundant.
> What? Perhaps in some programming languages, but catching exceptions globally in C# works just fine.
I think what sesm means (as do I) is this situation:
try { a(); }
catch (ex) { log_warn(ex); }
return b();
Right now, the function will continue executing and return a value even if an exception occurred, which sometimes is desirable. If you removed the catch block, nothing after a() will be executed.There are some cases where you basically have to make your own top-level error handling - for example in (java) worker threads. An uncaught exception would either terminate the thread or would be swallowed without showing up anywhere.