2009/10/2 Alex Schenkman <[email protected]>: > 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.' > > yes, something like that > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >
-- Best regards, Igor Stasenko AKA sig. _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
