You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current release, if an inlineCallback generator returns to a deferred callback that throws an exception, the traceback is confusing, e.g.:
Traceback (most recent call last):
File "/mnt/mesos/sandbox/.pex/install/Twisted-20.3.0-cp37-cp37m-manylinux1_x86_64.whl.1128a7e2b98487eb88697f10720d146583a69992/Twisted-20.3.0-cp37-cp37m-manylinux1_x86_64.whl/twisted/internet/defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
StopIteration: Response(code=200, message=b'OK')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/mesos/sandbox/__main__-D229445.750890.pex/infra_compute/proxy/proxy.py", line 291, in _proxy_request
simplified_response = yield self.proxy.process_request(simplified_request)
... # the real traceback we care about
This happens because the status.deferred.callback() is called from within the StopIteration exception handler. Python assumes that the StopIteration is the real exception we care about because that exception was being handled while the second exception was thrown. However, we don't care about the StopIteration exception, as it is only used to transmit a return value from the inlineCallback generator.
This can be avoided by first exiting the exception handler, then calling status.deferred.callback(). Python will no longer incorrectly tack on the StopIteration traceback on the top if there is an exception in the callback.
In the current release, if an inlineCallback generator returns to a deferred callback that throws an exception, the traceback is confusing, e.g.:
This happens because the
status.deferred.callback()
is called from within theStopIteration
exception handler. Python assumes that theStopIteration
is the real exception we care about because that exception was being handled while the second exception was thrown. However, we don't care about theStopIteration
exception, as it is only used to transmit a return value from theinlineCallback
generator.This can be avoided by first exiting the exception handler, then calling
status.deferred.callback()
. Python will no longer incorrectly tack on theStopIteration
traceback on the top if there is an exception in the callback.Searchable metadata
The text was updated successfully, but these errors were encountered: