Igor,
I'm trying to understand your suggestion.
Am I thinking correclty?

Thanks in advance!

On Thu, Oct 1, 2009 at 23:42, Igor Stasenko <[email protected]> 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.'
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to