Hi Alistair.

чт, 19 дек. 2019 г. в 07:10, Alistair Grant <akgrant0...@gmail.com>:

> I think the difference here is that in the playground 'self' is nil,
> while in the browser 'self' is the class being inspected.
> UndefinedObject>>handleSignal: tells the exception to execute its
> #defaultAction, which is to signal the UnhandledError, and thus it
> evaluates the block.
>

#handleSignal: is sent to contexts chain in the stack during error
processing which ends up at top context and its nil sender. It is not
related to the receiver of messages on the stack.


>
> One other thing to keep in mind, UnhandledError is a subclass of
> Exception.


That's correct. But it does not matter for my findings.


> It will only catch signals of itself, unlike Error or
> Exception, which will catch all their subclasses.  So 'MyTestError
> signal' can only be caught if something catches it and then signals
> UnhandledError.  In this  case it is the #defaultAction.
>

Yes, and here is the trick. When error resignals UnhandledError from the
defaultAction it is caught by UnhandledError handler but only if there was
no outer handler which already processed original error


> HTH,
> Alistair
>
>

Reply via email to