On Tue, Dec 18, 2018 at 1:20 PM Chris Muller <asqueaker@gmail.com> wrote:
Hi Marcel,

I've needed something like this before too, but since I also wanted to
work more with the Error's, I simply provided an additional Block for
the inner-layer which took each Error as the argument.  Then my
calling could log to Transcript or add to a separate Collection (since
I prefer to view "object messages" in an Explorer instead of only text
in the Transcript), and nicely avoids the unpleasant dependency on Transcript.

I also think it could just trap Error (or MessageNotUnderstood) since
that is the stated intended usage.  I think if one needed to specify a
custom exceptionOrExceptionSet, then it seems like they'd probably
just write normal error-handling code.

+1.  I was going to suggest the same thing.  It's much more flexible to factor the inner two methods as:

 try: aBlock ignore: exceptionOrExceptionSet
       "Evaluate aBlock with each of the receiver's elements as the argument. On error, skip that element and continue."

      ^self try: aBlock ignore: exceptionOrExceptionSet ifException: nil!

try: aBlock ignore: exceptionOrExceptionSet ifException: unaryBlockOrNil
      "Evaluate aBlock with each of the receiver's elements as the argument. On error, skip that element and continue."

      ^ self do: [:ea |
              [aBlock value: ea]
                      on: exceptionOrExceptionSet
                      do: [:err | unaryBlockOrNil ifNotNil: [unaryBlockOrNil value: err]]]!

then

try: aBlock ignore: exceptionOrExceptionSet logged: aBoolean
    ^self try: aBlock ignore: exceptionOrExceptionSet ifException: (aBoolean ifTrue: [[:err| Transcript showln: err messageText]])

_,,,^..^,,,_
best, Eliot