You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add an example to the tutorial that demonstrates collecting results from tasks #421
Actually, using Result.acapture in that example is wrong, because it'll swallow KeyboardInterrupt and Cancelled exceptions. We want something more like a conventional catch-all handler, like except Exception. And conventionally that would mean it needs to be replaced by MultiError.catch. Here we only really want to catch the Exception part of the MultiError, but in the common case where that's the whole MultiError, we want to preserve it as a single MultiError that we can pack into an Error object and add to the results list. Hmm.
I wonder if we should add something like a MultiError.split primitive that divides a MultiError into two pieces, those that match the predicate and those that don't... And maybe a catch_split built on it that catches all exceptions of a given class and hands them all at once to a handler? These might actually be the primitives we want for both cancel scopes and the log-and-discard-errors cases.
Activity
njsmith commentedon Jan 27, 2018
"How do I make a nursery that ignores child failures" might be a similar good example to have (also good example of
MultiError.catch).njsmith commentedon Jan 27, 2018
Actually, using
Result.acapturein that example is wrong, because it'll swallowKeyboardInterruptandCancelledexceptions. We want something more like a conventional catch-all handler, likeexcept Exception. And conventionally that would mean it needs to be replaced byMultiError.catch. Here we only really want to catch theExceptionpart of theMultiError, but in the common case where that's the wholeMultiError, we want to preserve it as a singleMultiErrorthat we can pack into anErrorobject and add to the results list. Hmm.I wonder if we should add something like a
MultiError.splitprimitive that divides aMultiErrorinto two pieces, those that match the predicate and those that don't... And maybe acatch_splitbuilt on it that catches all exceptions of a given class and hands them all at once to a handler? These might actually be the primitives we want for both cancel scopes and the log-and-discard-errors cases.See also #285, #59, #408, ...