Exception Hierarchies
Brett Taylor
btaylor at quiknet.com
Mon Aug 16 23:02:13 UTC 1999
I have seen some serious problems caused by the handling of the Error with
VSE. The main source of problems I have seen is caused by the fact that
MessageNotUnderstood is a subclass of Error. This can be a real problem in
code that is poorly tested, and exception handling has been added early in
the development cycle. I would favor a class hierarchy that kept
MessageNotUnderstood in a different branch than the generic error that would
be handled as proposed below.
> ["some risky code"] on: Error do: ["clean up after my code died"].
Brett Taylor
>-----Original Message-----
>From: Norton, Chris [mailto:chrisn at Kronos.com]
>Sent: Monday, August 16, 1999 1:29 PM
>To: 'squeak at cs.uiuc.edu'
>Subject: RE: Re: Exception Hierarchies
>
>
>Hi Folks.
>
>This response was written with the philosophy: "1) open mouth. 2) insert
>foot to kneecap." So, Alan, I am NOT trying to criticize you. :-)
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Alan Lovejoy [sourcery at pacbell.net] wrote:
>[...snip...]
>> Ah, then perhaps the problem is simply that "Error" is misnamed.
>>
>> I suggest the following hierarchy:
>>
>> Exception (the root class, takes no action if no handler is found,
>> proceedable by default)
>> DefaultHandlerException (takes some default action if no handler is
>> found)
>> HandlerRequiredException (raises NoHandlerException if no
>> handler)
>> ErrorException (root of all errors, not proceedable
>> by default)
>> WarningException
>> NoHandlerException (raised when no handler is found for
>> a
>> HandlerRequiredException, opens
>> default "UnhandledException"
>> notifier
>> if no handler found for NoHandler
>> exception)
>> ControlException
>> HaltException
>> UserInterruptException
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>I'm not an expert on Exception handling, but I sure find it handy to say:
>
> ["some risky code"] on: Error do: ["clean up after my code died"].
>
>I think that Error is a good "catch all" name for (near-)fatal exceptions.
>Having said that, I'd like to point out that in VSE, there is an exception
>handler called KeyboardInterrupt() that happens when you hit Ctrl-Break.
>This interrupt is subclassed from Notification(), which is not subclassed
>from Error. Perhaps the Halt and UserInterrupt should be subclassed from
>Notification() in Squeak. After all, they aren't really errors. They are
>simply interruptions that can (usually) be resumed.
>
>Just my $0.02. Cheers to Craig Latta, the folks at TFEI and to Steven Pope
>for making Exceptions happen in Squeak!!
>
>---==> Chris
>
More information about the Squeak-dev
mailing list
|