[Pharo-project] Improving Pharo's Exception Hierarchy

Sven Van Caekenberghe sven at beta9.be
Thu Apr 14 20:38:21 CEST 2011


Dale,

I think I understand some of your points, there based on valid concerns. We should end up with a minimal set of exceptions. The current set was not that large IMHO. But here and there some simplifications are possible.

Thanks for submitting a concrete alternative hierarchy.

However, it feels as if the reasons between using a class and a selector are a bit arbitrary. I can't make sense out of it.

Another thing that hasn't been discussed so far is what data should go in each exception.

This has to be done on a blackboard with a couple of people. And it won't be finished in one go either, far from it.

I'll print out your hierarchy as well !

Sven

On 14 Apr 2011, at 18:07, Dale Henrichs wrote:

> Using Sven's hierachy as a starting point and taking some cues from the GemStone exception hierarchy, I would suggest the following (names atarting with # are reasonCodes in the namespace of the parent exception class, instead of a unique class):
> 
> Exception (messageText reasonCode)
>  Abort
>  Error
>    NumericError
>      #floatingPointException
>      #rangeError
>      #naNError
>      ZeroDivide (dividend)	
>    FileStreamException (fileName)
>      #fileDoesNotExistException
>      #fileExistsException (fileClass)
>      #cannotDeleteFileException
>      #fileWriteError
>      #fileReadError **
>      #fileClosedException **
>      #cannotAccessFileException **
>      #readonlyFileException **
>    MessageNotUnderstood (message, receiver)
>    #nonBooleanReceiver (object)
>    OutOfMemory < handlers?>
>    ControlInterrupt
>      Halt
>        AssertionFailure
>      BreakPoint
>    CompileError
>      SyntaxError ** !exists! (input, position)
>        #numberFormatException **
>    #headlessError **
>    TimedOut ** (object, operation, timeout)
>    VerificationException
>    IllegalOperation ** (operation, object)
>    #sizeMismatch (objects)
>    #subclassResponsibility ** (message, receiver)
>    #notYetImplemented ** (message, receiver)
>    #cannotInstanciate ** (class)
>    #readOnlyObject ** (object)
>    OutOfFreeSpace ** <handlers?>
>    #invalidArgument ** (message, receiver, argument)
>    #notIndexable ** (object)
>    #noKeyedAccess ** (object)
>    #nonIntegerIndex ** (receiver, index)
>    #subscriptOutOfBounds ** (receiver, index, from, to)
>    NotFoundException ** (receiver, object)
>      #keyNotFound **
>      #valueNotFound **
>      #elementNotFound **
>    StreamException (stream)
>      #positionError ** (index, from, to)
>      EndOfStream **
>      #beginOfStream **
> 
>  Notification
>    Admonition
>      LowMemory ** <this should be a notification not an error>




More information about the Pharo-project mailing list