[Twisted-Python] addCallbacks issue

Christopher Armstrong radix at twistedmatrix.com
Mon Apr 12 18:08:11 EDT 2004

Sorin C. wrote:
> Any idea why addCallbacks fails to bound the error
> handler? I use Twisted 1.2.0.

Read the documentation.


There's another potential gotcha here. There's a method 
twisted.internet.defer.Deferred.addCallbacks which is similar to, but 
not exactly the same as, addCallback followed by addErrback. In 
particular, consider these two cases:

# Case 1
d = getDeferredFromSomewhere()

# Case 2
d = getDeferredFromSomewhere()
d.addCallbacks(callback1, errback1)
d.addCallbacks(callback2, errback2)

If an error occurs in callback1, then for Case 1 errback1 will be called 
with the failure. For Case 2, errback2 will be called. Be careful with 
your callbacks and errbacks.


  Twisted | Christopher Armstrong: International Man of Twistery
   Radix  |          Release Manager,  Twisted Project
---------+           http://radix.twistedmatrix.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20040412/cd810cb9/attachment.pgp 

More information about the Twisted-Python mailing list