async icon indicating copy to clipboard operation
async copied to clipboard

Added Condition and boundedForEach

Open jonasfj opened this issue 2 years ago • 0 comments

Adding:

  • Notifier with wait that'll be resolved when notify() is called. This is a primitive for signaling.
  • Stream.parallelForEach(maxParallel, eachFn, onError) for calling eachFn in parallel for each item in the stream.

It's possible that onError really should be called ignoreError and only take Object e or even Exception e. Since:

  • You shouldn't use the stack trace to decide if you are ignoring an error.
  • You should never ignore an error, only exceptions.

Or maybe we should call it continueIf, because it really makes sense to write: continueIf: (Exception e) => e is TimeoutException and things like that.

Having an onError method where you can choose to rethrow or not is really bad. Because Error.throwWithStackTrace is annoying to call, so people are likely to loose their stack traces.

jonasfj avatar Aug 16 '23 10:08 jonasfj