[Twisted-Python] Aborting callback chain with an errback

Andy Fundinger Andy at NewWorldElectric.com
Fri Sep 28 11:13:49 EDT 2007


What is the proper way to handle an uncorrectable error?  I have code
that looks like:

def callXMLRPC(self,stringValue,intValue):
   return(xmlProxy.callRemote("myFunc",{...}) \

.addCallback(self.rpcSuccess).addErrback(self.rpcFailure))

and in a derived class:

def specificQuery(self):
    return self.callXMLRPC("Ask Thing", 3).addCallback(self.handleResult)

what I'd like to have happen is if an error is raised in callRemote,
rpcFailure does some cleanup and no further callbacks are executed.  I
can't fix the failure, but I don't want a message logged into my error
log everytime, it's not unhandled, just that there's nothing to be
done and callbacks won't have the data to run.  If I want to deal with
it further I'd want to do it in the base class.  How can I do that?
Am I doing something nonsensical here?

Andy Fundinger


--
Blog:  http://channel3b.wordpress.com
Second Life Name:  Ciemaar Flintoff




More information about the Twisted-Python mailing list