The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
Exception handling is not something that can be done generically. Especially at the 'Exception' level.
In certain cases one might generalize exception handling but only within the limits of some specific idiom. For example a specific inheritance model might provide a generic handler in the base class, but even then it should be considered as a convenience rather than as an absolute.
And generalizing logging is not going to work either. For example for DB api calls logging a primary id might be a good idea, while with a web API call logging the url is probably needed. There are a lot of variations even within those.
Not to mention that logging libraries seem to provide calls that support general purpose logging including exceptions so that would seem to do what that code does.
Far as I know the above would be true for all languages that throw exceptions. It is true for java, c# and c++.
Anything wrong with you adding the necessary exception name, recompiling and running the example again in your debugger. The only problem I can think of is if your code take 3 hours to compile (like one codebase I worked on )
Pretty much along similar lines.
Why do people still put their names / e-mails / former places of employment etc. in preamble of published software text after intentionally or "accidentally" removing all comments / functions descriptions etc ?
That happens to me. I'll write a document requested by the field service group. I send it to them. They remove the formatting, copy/paste random sentences, arbitrarily insert spelling errors, and then publish it as final documentation to our customers.