[Twisted-Python] adbapi question

Jp Calderone exarkun at intarweb.us
Fri Sep 26 10:41:28 EDT 2003


On Fri, Sep 26, 2003 at 05:08:58PM +0300, Ruslan Spivak wrote:
> [snip]
> 
> 
> def dbClientFailed():
>     print "Failed!"
>     reactor.stop()
> 
> getClientsDBParams('alienoid').addCallbacks(dbClientSucceeded, 
> dbClientFailed)
> reactor.run()
> 
> 
> The problem here is that when dbClientSucceeded is executed and i get 
> "no records" - i don't get exception. Only when i press Ctrl + C on 
> server i get those DBException. This code will be executed when remote 
> client connects to server and i want those DBException be passed to 
> remote client but i can't get it, can get it only with Ctrl + C
> 
> Your help is very appreciated.
> Thanks in advance.

  Errbacks receive a single argument, the failure that caused them to be
caused.  Unfortunately, if you define your errback to take no arguments (as
you have), that error becomes a failure, which would pass on to the next
errback if it were registered, or, as in your code, would be silenced if
there are no more errbacks.

  Redefine dbClientFailed to take an argument and you should see the
behavior you expect.

  Jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20030926/231548a7/attachment.pgp 


More information about the Twisted-Python mailing list