5

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

rationalrevolt
  • 663
  • 1
  • 6
  • 13

1 Answers1

6

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).

JayK
  • 3,006
  • 1
  • 20
  • 26
  • I'm wondering what invokes #defaultAction? I suspect that it's invoked from `UndefinedObject>>handleSignal:` when there are no more exception handlers in the call chain. Is this true? Or, is the VM sending that message when no more handlers remain? – rationalrevolt Jul 16 '18 at 15:46
  • @rationalrevolt Yes, it's true. The VM isn't involved in the way exceptions are handled. – Leandro Caniglia Jul 16 '18 at 19:09