avoid twisted's overly eager traceback trimming
avoid twisted's overly eager traceback trimming

So this is a subtle one. Twisted's error handling is pretty hugely
complex, in the interest of re-creating tracebacks to be more
reminiscent of the async execution flow. Thrift is creating exceptions
and errbacking Deferreds with them (instead of raising the exceptions),
which means it has no meaningful traceback to attach to the Failure
objects created. Twisted wants to keep only the traceback attached to a
Failure in the first place (the lowest part), plus the traceback that
was caught the last time the Failure was raised (the highest part).  The
detection of 'the middle part' is made by inspecting the deepest part of
a traceback: if an error being errbacked was originated by
Failure.raiseException(), or Failure.throwExceptionIntoGenerator(), then
the original Failure object is plucked out and any intervening traceback
is discarded.

In the case of Thrift-twisted code below an inlineCallbacks-wrapped
generator, the 'highest part' of the traceback is empty, and the 'lowest
part' is also empty when coming from throwExceptionIntoGenerator(), so
Thrift tracebacks are free of useful context.

This fix creates a new Failure object within Telephus when we receive a
traceback-less Failure from Thrift. The new Failure is equivalent to the
old, except it is not originated in one of the Failure.reraise methods,
which makes more traceback get collected once we are above it on the
stack.

Phew, mucking with Twisted error handling always makes me want to go
straight to Erlang and never look back.

Metaswitch/Telephus,driftx/Telephus,driftx/Telephus,ClearwaterCore/Telephus,Metaswitch/Telephus,ClearwaterCore/Telephus