<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">On Tue, Dec 18, 2018 at 1:20 PM Chris Muller <<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi Marcel,<br>
<br>
I've needed something like this before too, but since I also wanted to<br>
work more with the Error's, I simply provided an additional Block for<br>
the inner-layer which took each Error as the argument.  Then my<br>
calling could log to Transcript or add to a separate Collection (since<br>
I prefer to view "object messages" in an Explorer instead of only text<br>
in the Transcript), and nicely avoids the unpleasant dependency on Transcript.<br>
<br>
I also think it could just trap Error (or MessageNotUnderstood) since<br>
that is the stated intended usage.  I think if one needed to specify a<br>
custom exceptionOrExceptionSet, then it seems like they'd probably<br>
just write normal error-handling code.<br></blockquote><div><br></div><div>+1.  I was going to suggest the same thing.  It's much more flexible to factor the inner two methods as:</div><div><br></div><div> <span style="color:rgb(0,0,0)">try: aBlock ignore: exceptionOrExceptionSet</span></div><span style="color:rgb(0,0,0)">       "Evaluate aBlock with each of the receiver's elements as the argument. On error, skip that element and continue."</span><br style="color:rgb(0,0,0)"><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">      ^self</span><span style="color:rgb(0,0,0)"> try: aBlock </span><span style="color:rgb(0,0,0)">ignore: exceptionOrExceptionSet </span><span style="color:rgb(0,0,0)">ifException: nil!</span><br style="color:rgb(0,0,0)"><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">try: aBlock ignore: exceptionOrExceptionSet ifException: unaryBlockOrNil</span><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">      "Evaluate aBlock with each of the receiver's elements as the argument. On error, skip that element and continue."</span><br style="color:rgb(0,0,0)"><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">      ^ self do: [:ea |</span><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">              [aBlock value: ea]</span><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">                      on: exceptionOrExceptionSet</span><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">                      do: [:err | </span><span style="color:rgb(0,0,0)">unaryBlockOrNil</span><span style="color:rgb(0,0,0)"> ifNotNil: [</span><span style="color:rgb(0,0,0)">unaryBlockOrNil value: err</span><span style="color:rgb(0,0,0)">]]]!</span></div><div class="gmail_quote"><font color="#000000"><span style="caret-color: rgb(0, 0, 0);"><br></span></font></div><div class="gmail_quote"><font color="#000000"><span style="caret-color: rgb(0, 0, 0);">then</span></font></div><div class="gmail_quote"><font color="#000000"><span style="caret-color: rgb(0, 0, 0);"><br></span></font></div><div class="gmail_quote">try: aBlock ignore: exceptionOrExceptionSet logged: aBoolean</div><div class="gmail_quote">    ^self <span style="color:rgb(0,0,0)">try: aBlock ignore: exceptionOrExceptionSet ifException: (</span>aBoolean ifTrue: [[:err| Transcript showln: err messageText]])</div><div class="gmail_quote"><br></div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div></div></div></div></div></div></div>