On Sun, Apr 7, 2019, 12:13 Tim Mackinnon <tim@testit.works> wrote:

> Hi - I’m wondering what the best way for handling multiple exceptions is
> in Pharo?
>
> It seems like we just have on:do: (where on is a single exception?).
>
> However, I think I’ve noticed that you can concatenate exceptions - so
> DomainError, ZnHttpUnsuccessful - and then pass that to on:
>
> However, I’m not clear on how we then elegantly process the exception if
> you want to do different things (which is often the case for unrelated
> exceptions). I am kind of superseded there isn’t on:do:on:do: (although
> that seems quite ugly).
>
> So I’m curious how you handle different exceptions without having some
> sort of case statement in the exception handler? Or do you wrap exceptions
> handlers over top of each other?
>

This last one.

[[self run]
    on: TestFailure
    do: [:testEx | ...]]
        on: Error
        do: [:error | ...]


> Tim
>

Reply via email to