[Twisted-Python] Trapping exceptions in Deferred

Christopher Armstrong radix at twistedmatrix.com
Tue May 12 13:31:49 MDT 2015


> On May 12, 2015, at 1:25 PM, Mashiat Sarker Shakkhar <mashiat.sarker at gmail.com> wrote:
> 
> On Tue, May 12, 2015 at 1:38 PM, Louis D. Burr <ldanielburr at me.com <mailto:ldanielburr at me.com>> wrote:
> Hi Mashiat,
>  
> [...]
>  
> Thanks for providing the example.  Your code as presented here catches both TimeoutError and ResponseNeverReceived, so I am not sure why you think it isn’t working.  What are you seeing that indicates that the ResponseNeverReceived error is not being trapped?
> 
> Because I still see the exception in my logs. I could not find any way to reproduce the error - so I am playing a bit of a cat-and-mouse game here. For one thing, the log message is not very helpful. OpenSSL.SSL.Error is just a base class and I can't get Twisted to print stack trace for unhandled exceptions.

Your code example is printing the error message and traceback _before_ you trap the failure. Are those print statements going to your logs? Could that be causing confusion?

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20150512/bcc0cb67/attachment-0002.html>


More information about the Twisted-Python mailing list