[Pharo-project] Improving Pharo's Exception Hierarchy

Dale Henrichs dhenrich at vmware.com
Thu Apr 14 18:07:45 CEST 2011


On 04/14/2011 05:08 AM, Toon Verwaest wrote:
> Right, so you confirm the experience of Dale.
>
> In the case of flagging errors without classes, do you generally just
> use a simple symbol, or concatenate strings to convey more details? This
> last seems somehow a bad idea... but maybe if it's never caught it's not
> so relevant?
>

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