[Twisted-Python] Catching error in protocol.ReconnectingClientFactory

Martin martin at webscio.net
Mon Jun 11 09:01:25 MDT 2012


Hi there,

I've been looking around for a solution for several hours now, and maybe 
I'm just missing something..

I've a factory that implements protocol.ReconnectingClientFactory which 
works just fine, however, whenever the program ends running, I get a 
bunch of Unhandled error in Deferred messages in my log for each 
disconnection that occurred during runtime, such as Failure: 
twisted.internet.error.ConnectionLost: ...

Is there any way I could somehow "handle" these during runtime, so that 
my log wouldn't be spammed with this at the end.. (or avoid it being 
spammed somehow..) I really don't care what the solution is, I already 
have the following method that logs everything for me
def clientConnectionLost(self, connector, reason):
         log.msg('Lost connection. Reason: %s' % reason)

just annoying that it's still finds the need to print it out at the end.

Anyway, I don't claim to be anywhere near proficient in Twisted, so any 
help would be greatly appreciated.


Thanks a lot in advance.

Martin




More information about the Twisted-Python mailing list