[Twisted-Python] catching adbapi 'thread' failures

Dave Peticolas dave at krondo.com
Thu Aug 19 00:52:01 EDT 2004


adbapi used to log failures before throwing them back.
This may be what you are seeing.

dave

On Wed, 2004-08-18 at 19:48, Clark C. Evans wrote:
> Howdy.  I'm stumped.  I thought I knew how failures work, but I
> can't seem to stop a traceback from appearing with the following:
> 
>     from twisted.internet import reactor
>     from twisted.python.util import println
>     from twisted.enterprise import adbapi 
>     dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL', database='testing')
>     def interaction(trans):
>         trans.execute('sqlerror')
>         return trans.fetchall()[0][0] 
>     def catch(failure):
>         return "***" + failure.getErrorMessage().strip() + "***"
>     def use_pool():
>         d = dbpool.runInteraction(interaction)
>         d.addErrback(catch)
>         d.addCallback(println)
>         d.addCallback(lambda _: reactor.stop())
>     reactor.callLater(0, use_pool)
>     reactor.run() 
> 
> Any help would be wonderful,
> 
> Clark





More information about the Twisted-Python mailing list