More exception handling debate

Thursday 27 January 2005

First Raymond Chen wrote that exceptions are cleaner, more elegant, and harder to recognize:

It is extraordinarily difficult to see the difference between bad exception-based code and not-bad exception-based code. ...

My point isn't that exceptions are bad. My point is that exceptions are too hard and I'm not smart enough to handle them. (And neither, it seems, are book authors, even when they are trying to teach you how to program with exceptions!)

Max Ischenko responded, writing about exception-based code and exception-based code antipatterns:

Overall, exception seems to be a net benefit. Result is a more stable program (fails early) with less efforts (fewer places to do error handling). Yes, it's hard to write a good exception-based code, harder then write a good error-code-based code but who said it's going to be easy?

There is no such thing as a free launch, after all.

So everyone agrees that exceptions (or any other comprehensive approach to error checking) is hard.

In response to Max, Ian Bicking writes about good catch all exceptions:

The most obvious case: it's not bad at all to catch all exceptions if you re-raise them.

I've written at length about my philosophy of exceptions. As David Byrne said, "say something once, why say it again?": Exception vs. status returns and Exceptions in the rainforest.


Add a comment:

Ignore this:
not displayed and no spam.
Leave this empty:
not searched.
Name and either email or www are required.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.