Search code examples
smalltalksqueak

How does the implementation of #doesNotUnderstand in the Object class result in opening a debugger in Squeak smalltalk?


I know that the implementation signals a MessageNotUnderstood exception, but how does that end up opening a debugger?


Solution

  • When an Exception remains unhandled after it has been signalled, its #defaultAction is invoked. MessageNotUnderstood>>defaultAction delegates to Error>>defaultAction, which signals an UnhandledError (another Exception). This exception, in turn, has a defaultAction whose code reads like this:

    ^ ToolSet debugError: self exception
    

    ...which opens the debugger if you use the StandardToolSet (which is the default in regular Squeak images).