Hi

If I want to trap a certain type of exception in a deferred call, how do I
specify it? For example, I see a failure like this:

    [HTTP11ClientProtocol (TLSMemoryBIOProtocol),client]
[<twisted.python.failure.Failure <class 'OpenSSL.SSL.Error'>>]

    [HTTP11ClientProtocol (TLSMemoryBIOProtocol),client] Traceback
(most recent call last):
    [HTTP11ClientProtocol (TLSMemoryBIOProtocol),client] Failure:
twisted.web._newclient.ResponseNeverReceived: [<twisted.python.
failure.Failure <class 'OpenSSL.SSL.Error'>>]

I want to trap all such failures. I tried
`failure.trap(twisted.web._newclient.ResponseNeverReceived)` but looks
like that did not work. My deferred callback looks like this:

Hi

If I want to trap a certain type of exception in a deferred call, how
do I specify it? For example, I see a failure like this:

    [HTTP11ClientProtocol (TLSMemoryBIOProtocol),client]
[<twisted.python.failure.Failure <class 'OpenSSL.SSL.Error'>>]

    [HTTP11ClientProtocol (TLSMemoryBIOProtocol),client] Traceback
(most recent call last):
    [HTTP11ClientProtocol (TLSMemoryBIOProtocol),client] Failure:
twisted.web._newclient.ResponseNeverReceived: [<twisted.python.
failure.Failure <class 'OpenSSL.SSL.Error'>>]

I want to trap all such failures. I tried
`failure.trap(twisted.web._newclient.ResponseNeverReceived)` but looks
like that did not work. My deferred callback looks like this:

    from twisted.internet.error import TimeoutError
    from twisted.web._newclient import ResponseNeverReceived
    def log_ignore_network_errors(failure):
        print failure.getErrorMessage()
        failure.printTraceback()
        failure.trap(TimeoutError, ResponseNeverReceived)

Apparently this does not catch all such errors. What am I doing wrong here?

Regards
Shakkhar
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to