Programmer's Reference

Default exception handler

Instances of ExceptionalEvent can have a default handler block that is run if the exception occurs outside of a when:do expression.

| anException |
(anException := ExAll newChild)
   defaultHandler: [:signal |
     self error: 'The exception was not expected at this time.'].
anException signal.

If desired, the default handler block can be run from inside of a handler block by sending handlesByDefault to the handler's signal argument.

Note:The exitWith: and retry messages cannot be used in the default handler block unless the expression that caused the exception was run inside the receiver block of a when:do: expression.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]