[Twisted-Python] Catching error in protocol.ReconnectingClientFactory
glyph at twistedmatrix.com
Wed Jun 13 14:50:56 EDT 2012
On Jun 11, 2012, at 8:01 AM, Martin wrote:
> 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..)
These messages are coming from some code which is issuing Deferreds, not from ReconnectingClientFactory. You need to add an errback to those Deferreds in your application code. There's no way to write a catch-all, just like there's no way to write a catch-all that can stop exceptions from being raised in basic Python.
I can't say more without a code example, preferably a <http://sscce.org/>.
More information about the Twisted-Python