[Twisted-Python] Catching error in protocol.ReconnectingClientFactory

Phil Mayers p.mayers at imperial.ac.uk
Tue Jun 26 01:43:17 MDT 2012


On 06/25/2012 10:47 PM, Martin wrote:

> Well, kind of - I know that I need to do addErrBack on the deferred
> objects, I kind of knew that when I asked the original question having
> read the documentation on deferreds. What I still don't know though is
> how am I supposed to catch these deferreds - that is not being explained
> anywhere in the documentation I'm afraid.

What do you mean by "catch these deferreds"?

A deferred is just a return value of a function, either in the Twisted 
API or your own code. For example:

from twisted.web import client

def ignore_err(failure):
     pass

def work():
     a_deferred = client.getPage(...)
     a_deferred.addErrback(ignore_err)

If you are seeing unhandled errors in deferreds and you don't know which 
deferreds, you're probably throwing away a return value somewhere. The 
traceback should point you in the right directon.




More information about the Twisted-Python mailing list