[Cuis-dev] catch of MessageNotUnderstood

Jaromir Matas mail at jaromir.net
Sun Jun 30 15:48:40 PDT 2024


Hi Mark,


On 30-Jun-24 11:48:16 PM, "Mark Volkmann via Cuis-dev" 
<cuis-dev at lists.cuis.st> wrote:

>I'm studying how the doesNotUnderstand method is used. I see that the 
>implementation in the Object class signals a MessageNotUnderstood 
>error. But I haven't been able to find the code that catches that and 
>opens a MessageNotUnderstood window. Where does that happen?
A quick summary of events:

1. VM sends doesNotUnderstand: message - in your particulr case the one 
implemented in Object will be called
2. Object's doesNotUnderstand: executes and signals MessageNotUnderstood
3. the signal method traverses the sender chain (= all contexts in the 
execution stack, starting from the top, most recent) until it finds a 
context containing a usable handler or, if there is no such handler 
present, until it reaches the bottom of the stack - which is nil
4. then the signal method sends handleSignal: which is also 
polymorphically defined under UndefinedObject and from there the 
defaultAction message is sent to the MessageNotUnderstood exception and 
reachedDefaultHandler is set to true, but:
5. as the exception is also an Error instance it also executes Error's 
defaultAction and signals UnhandledError and the search for the handler 
starts over ;)
6. if no handler is found on the current exection stack - this time for 
the UnhandledError , the search ends with nil again and the 
defaultAction message is sent to the exception - which for this 
exception opens the Debugger


This should roughly cover the process...

best,
Jaromir
>
>
>--
>R. Mark Volkmann
>Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240630/678025e2/attachment.htm>


More information about the Cuis-dev mailing list