« Infinite Energy | Main | Fun with Vista blundly contradicting itself »

July 26, 2008

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341d80a253ef00e553bafd688833

Listed below are links to weblogs that reference Error Handling Crimes:

Comments

Dimitris Papadimitriou

I totally share your anger! I faced exactly the same problem a few days ago while doing some C# code review myself (returning enumeration instead of the exception itself). I suppose you are talking about C++?
Fortunately in .NET world plug-ins like Resharper display warnings (which you can upgrade to errors) when the exception variable in a try/catch block is not handled properly or not handled at all. Unfortunately the developer in this case completely ignored this warning! This is another common problem which I would name 'Warning handling crime'!
I have to disagree thought that to do proper error handling you need to double your code. I don't know about C++ but in .NET world in most cases not writing exception handling (I know that I'm making) works fine. Only in specific cases, such as when you want to translate an exception into a more explicit one (of course there are other cases also). An in 99% of these cases you need to put the original exception as InnerException of the new more explicit one. If you don't then it could be as tragic as using the return value!
ps. I'm doing the convention here that error and exception are equal which is not completely true. But in the context we are talking about I guess its ok.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment