Thanks Richard - indeed it was that VisualAge Smalltalk pattern that I was 
remembering and looking for in Pharo, and was a bit surprised it wasn’t there - 
and hence thought there’re was possibly a different way.

 I might propose we add this, if no-one else comes up with a better 
alternative. Handling both application and http exceptions is quite a common 
pattern - and you don’t always want to do the same blanket thing.

Tim


Sent from my iPhone

> On 8 Apr 2019, at 04:48, Richard O'Keefe <rao...@gmail.com> wrote:
> 
> VisualAge Smalltalk has, in addition to the standard #on:do:,
> #when:do:, ..., #when:do:#when:do:#when:do:#when:do:#when:do:,
> with the last four mapping to #whenOneOf:doMatching:, taking
> two arrays.
> 
> It's easy enough to add your own methods like
> on: exn1 do: act1 on: exn2 do: act2
>     "An imperfect emulation of VAST's #when:do:when:do:"
>     ^[self on: exn1 do: act1] on: exn2 do: act2
> 
> on: exn1 do: act1 on: exn2 do: act2 on: exn3 do: act3
>     "An imperfect emulation of VAST's #when:do:when:do:when:do:"
>     ^[[self on: exn1 do: act1] on: exn2 do: act2] on: exn3 do: act3
> to BlockClosure.  It won't be fast, but your code might be
> clearer.
> 
> 
>> On Mon, 8 Apr 2019 at 10:21, Tim Mackinnon <tim@testit.works> wrote:
>> 
>> Thanks, I guess that makes sense, although it somehow looks a bit ugly with 
>> the nested brackets.. but nothing else springs to mind so maybe I’ll get 
>> used to it (and In my case I think it’s likely 2 or 3 different exceptions)
>> 
>> Tim
>> 
>> Sent from my iPhone
>> 
>> > On 7 Apr 2019, at 20:43, Richard Sargent 
>> > <richard.sarg...@gemtalksystems.com> wrote:
>> > 
>> > 
>> > This last one.
>> > 
>> > [[self run]
>> >     on: TestFailure
>> >     do: [:testEx | ...]]
>> >         on: Error
>> >         do: [:error | ...]

Reply via email to