[Twisted-Python] How to chain deferred calls

Valeriy Pogrebitskiy vpogrebi at verizon.net
Wed Oct 21 14:53:31 MDT 2009


Add another .addErrback() directly after adc1() - to handle that  
specific exception...


Kind regards,

Valeriy Pogrebitskiy
vpogrebi at verizon.net




On Oct 21, 2009, at 4:12 PM, vitaly at synapticvision.com wrote:

> hi,
> how can I chain in defer methods that could raise exception while
> showing the exception that coming from method? I mean, if I'll do:
> return (
>   adc1().abc2().abc3().addErrback("Common2AllException")
> )
> than "Common2AllException" will be raised if abc1() raise Exception,
> but I'd like to see the adc1() own exception (and not
> "Common2AllException") ?
>
>
>
> t = Test()
> def abc1(self):
>   if t.test() is None:
>     raise Exception("Error11")
>   else:
>     return 1
>
> def abc2(self):
>   if t.test() is None:
>     raise Exception("Error12")
>   else:
>     return 1
>
> def abc3(self):
>   if t.test() is None:
>     raise Exception("Error13")
>   else:
>     return 1
>
>
>
>
> Appreciate the help.
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python





More information about the Twisted-Python mailing list