[Twisted-Python] FirstError handling from defer.gatherResults()?

Justin Warren daedalus at eigenmagic.com
Wed Nov 5 01:22:23 EST 2008

On Wed, 2008-11-05 at 00:36 -0500, Jean-Paul Calderone wrote:

> >Yes, ok. That's what I thought I should be doing, however trial appears
> >to still think that the error I've trapped has occurred, and ERRORs the
> >test. Am I not clearing state somewhere? I thought that simply handling
> >the failure (and not returning a Failure from the errback) would stop
> >this?
> The Deferred in the list you passed to gatherResults still failed
> because gatherResults doesn't pass consumeErrors=True to the DeferredList
> it created.  So even though you trapped the failure from the Deferred
> gatherResults returned, the original Deferred still has an unhandled
> failure and your test gets an error.
> To fix this, use DeferredList instead of gatherResults (or your own
> version of gatherResults that does pass consumeErrors=True) or add
> your own errbacks to all the Deferreds in the list after you've
> passed the list to gatherResults.

Awesome! Thanks Jean-Paul.

To the code!

Justin Warren <daedalus at eigenmagic.com>

More information about the Twisted-Python mailing list