Proposal: Extensible exceptions

David Menendez dave at
Mon Jul 7 15:39:39 EDT 2008

On Mon, Jul 7, 2008 at 5:47 AM, Henning Thielemann
<lemming at> wrote:
> On Sun, 6 Jul 2008, David Menendez wrote:
>> I don't recall calling anything "proper exception handling". I said
>> that it's reasonable to report certain programming errors through the
>> exception handling mechanism because it allows a running program to
>> clean up before it terminates.
> You can try to report programming errors to the user - but that's debugging.
> Where is the need to mix that with regular exception handling?

I wasn't talking about reporting errors to the user. I meant reporting
errors to the rest of the program.

>> Yes, a program that divides by zero should be fixed. If a program has,
>> say, locked a file and then encounters an error, are you suggesting
>> that the program should crash without unlocking the file?
> If your program is buggy, then it may well be that the file to unlock is
> already unlocked and deleted. By trying to recover from an error a division
> by zero can cause even more severe damages. It is not possible to handle
> errors in a way like exceptions, because exceptions are (rare but) expected
> situations, that can well be handled. In contrast to that you do not know
> the concrete errors in your program, otherwise you would have fixed them
> already.

I think we're conflating two uses of "recover" here. If a program
divides by zero, it can't sensibly continue, but it may need to clean
up some things before it terminates. And yes, if the cleanup code is
itself buggy it can make things worse, but that's a separate issue.

Dave Menendez <dave at>

More information about the Libraries mailing list