[Twisted-Python] Counting errors in a DeferredList and avoiding Unhandled error in Deferred messages

If I pass a list of deferreds to DeferredList and want to add a callback to the DeferredList to look at whatever errors have occurred in the underlying deferreds, should I do something like this:
deferreds = [] for x in whatever: deferreds.append(funcReturningDeferred(x))
dl = DeferredList(deferreds) dl.addCallback(errorCheckingFunc)
for d in deferreds: d.addErrback(lambda _: pass)
This ensures that errorCheckingFunc gets defer.FAILURE for those deferreds that finished up in their errback chain. Adding the lambda _: pass errback to each deferred in deferreds after it has been passed to DeferredList makes sure the errback chain doesn't later reach its end with an unhandled error.
It that the right/best/approved way to handle needing to deal with errors in the callback of a DeferredList and not trigger the "Unhandled error in Deferred" message?
Terry

* Terry Jones terry@jon.es [2008-05-05 19:10:39 +0200]:
If I pass a list of deferreds to DeferredList and want to add a callback to the DeferredList to look at whatever errors have occurred in the underlying deferreds, should I do something like this:
You might want to look at the gatherResults() utility function which returns a deferred that either fires with a list of the results, or errbacks with the first error to occur.
participants (2)
-
Terry Jones
-
Tristan Seligmann