On Thu, Oct 1, 2009 at 23:42, Igor Stasenko
<siguctua@gmail.com> wrote:
How about a visitor pattern?
[ a block of code where you do something that can singal different exceptions �]
� �on: Error do: [:ex |
ex visitWith: self
]
I had to replace self with a class handling the errors:
[ZeroDivide new signal: 'zero']�
�� �on: Error do:�
� [:error | error visitWith: (MyErrorHandler new)].
Error>>visitWith: anErrorHandler
�� �^ anErrorHandler handleError: self
MyErrorHandler>>handleError: anError
�� �^anError signal
Error subclass: #AlexError
AlexError>>visitWith: anErrorHandler
�� �^ anErrorHandler handleAlexError: self
AlexError>>handleAlexError: anAlexError
�� �^'Handling an AlexError now.'�