2009/10/1 Mariano Martinez Peck <marianopeck@gmail.com>:
2009/10/1 Hernan Wilkinson <hernan.wilkinson@gmail.com>
do this...
[[[[ a block of code where you do something that can singal different exceptions ]    on: XXXError    do: [ : ex | 'I do what I need to do when I get the error XXX' ]]    on: YYYError    do: [ : ex | 'I do what I need to do when I get the error YYY' ]]    on: Error    do: [ : ex | 'here I do in the rest of the cases' ]]    ensure: [ 'Here I do what I always need to do, no matter if there is an error or not' ]
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 ] and then in each error subclass, you can do visitWith: handler ^ handler handleXXXerror: self while, by default, Error could implement this method as: visitWith: handler ^ handler handleError: self so, instead of bunch of cases, you having a bunch of methods, which handling particular case. -- Best regards, Igor Stasenko AKA sig.