[Twisted-web] Double tracebacks for t.web & klein

Phil Mayers p.mayers at imperial.ac.uk
Mon Sep 16 10:58:15 MDT 2013


I'm playing with klein for a simple rest API (because I like the 
routing, mainly).

When a method raises an exception, a traceback gets logged twice - once 
by the t.web Request.processingFailed, called from here:

https://github.com/twisted/klein/blob/master/klein/resource.py#L125

...and once by the deferred garbage collection, as 
Request.processingFailed doesn't eat the deferred:

http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.1.0/twisted/web/server.py#L314

Obviously this double-traceback thing is hugely irritating. Who is at 
fault here? Is t.web doing the right thing by returning the failure from 
processingFailed, or is klein doing the wrong thing, either by using the 
(undocumented) processingFailed or omitting an errback further down the 
chain?

Obviously there's no way for *me* to add an errback - klein generates 
the deferred for me.



More information about the Twisted-web mailing list