[Twisted-Python] ClientCreator error handling
Hi, I don't know if this is right place to ask this kind of question but I'm really stuck at this problem and documentation seems not help (or better, I'm dumb). For me who uses try/except on daily basis the twisted error handling seems to be voodoo. All I want to do is add 'connection refused', 'dns lookup er ror' and similiar handling to the sshsimpleclient.py script. I tried something like: def errorCallback(failure): print "Err" [...] # other code d = defer.Deferred() d.addErrback(errorCallback) protocol.ClientCreator(reactor, SimpleTransport).connectTCP(HOST, 22) reactor.run() but that's probably have nothing to do with way it should be done.. Anyone could help me please? Concerned about your privacy? Instantly send FREE secure email, no account required http://www.hushmail.com/send?l=480 Get the best prices on SSL certificates from Hushmail https://www.hushssl.com?l=485
On Tue, 2006-03-07 at 19:19 +0100, Mike Christey wrote:
def errorCallback(failure): print "Err" [...] # other code
d = defer.Deferred() d.addErrback(errorCallback) protocol.ClientCreator(reactor, SimpleTransport).connectTCP(HOST, 22) reactor.run()
protocol.ClientCreator(reactor, SimpleTransport).connectTCP(HOST, 22).addErrback(errorCallback) ClientCreator.connectTCP returns a Deferred. -- Itamar Shtull-Trauring http://itamarst.org
participants (2)
-
Itamar Shtull-Trauring
-
Mike Christey