[Twisted-Python] The Real Error (tm) [was Re: how to write a safe catch-all]
chris at simplistix.co.uk
Fri Oct 1 09:19:15 EDT 2010
On 30/09/2010 18:01, Phil Mayers wrote:
> It is more than a little confusing, and I'm sure frustrating.
> I've tried to produce something like this locally, but cannot.
The very first message in this thread (28th Sept, 14:48) and my email of
30th Sept, 14:36 both had scripts attached which do exactly this..
> Let me see if I understand the problem in full.
> You have an @inlineCallbacks-decorated generator which is the target of
> a LoopingCall, like so:
> def loop():
> lc = task.LoopingCall(loop)
# Check for files to send on schedule
log.err(None,'Unhandled exception ...')
...although I'm currently changing the loop function to be:
...as this appears to give me what I want, until something proves
> You want this loop function to catch& log all exceptions resulting from
> work it initiates.
Yep, errbacks, internal twisted bugs, whatever. As long as they're
logged by something, preferabyl the try-except above, I don't mind.
What absolutely must not cannot ever happen is for the scheduler to die ;-)
> Your "somework" function calls, amongst other things, an
> @inlineCallbacks-decorated worker function:
> def sendTransmission(...):
> yield maybeDeferred(feed.initiateTransmission)
> ...some handling
> You are seeing two errors:
> 1. A GeneratorExit exception. This appears (if I'm reading your
> logging right) to be caught by your logging?
> 2. A ConnectionLost exception. This is not caught by your logging, and
> is propagating up to the reactor, and giving "Unhandled Error"
More information about the Twisted-Python