-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Damn you empty catch block #109
Comments
Comment by Calum Leslie on Tuesday, 9 November 2010 16:04 (imported from Disqus): At a previous workplace of mine I found that a wrapper, which had only a "try" and a "finally" (it was designed to clean up after exceptions), was eating exceptions. I investigated to find that between the lovingly-crafted "try" and "finally" blocks, someone had inserted the following: catch( Exception e ) {
|
Comment by Bob on Thursday, 13 January 2011 00:53 (imported from Disqus): COM interop makes you do it. There are some horrendous COM APIs out there and those that dont return S_OK throw an excaption in .net, which is horrible. I recently had to use the Task Scheduler COM API and it had an unqueryable dictionary - the only way to test was to Get and catch the exception which simply was the HRESULT saying key not found. Sometimes an empty catch block is better than a shitty COM API bombing out your app when the HRSEULT is actually perfectly valid...... |
Comment by stuart on Thursday, 13 January 2011 01:28 (imported from Disqus): COM Interop is a dirty, and necessary evil, and I've had to do my fair share of it. Exception handling can be a pain, admittedly. A lot of the time though, I'd still rather add a log or trace message rather than just leave it empty. This blog post was more aimed toward the more general case of someone swallowing an exception either because they were lazy or didn't see the benefit of logging the error or some such. |
Comment thread for the post Damn you empty catch block
The text was updated successfully, but these errors were encountered: