[Twisted-Python] failures, errbacks and exception handling

Atilla theatilla at gmail.com
Wed Apr 9 02:20:07 MDT 2008


On 09/04/2008, Nathan <nathan.stocks at gmail.com> wrote:
> On Tue, Apr 8, 2008 at 2:18 PM, Drew Smathers <drew.smathers at gmail.com> wrote:
>  >  def crash(reason):
>  >     log.err('ERROR: %s' % reason)
>  >     ... Do the rollback or whatever else ...
>  >     reason.printTraceback()
>
>
> Just a note on the rollback: if there's an error, the adbapi run*
>  methods roll the transaction back before sending the error to the
>  errback -- so I don't know of anything left to rollback in the
>  errback.
>
>
>  ~ Nathan

Yes, there's no need to rollback anything. I just want to attempt a
retry on the transaction, in cases of lock timeouts or deadlocks,
since there'll be the possibility of running clashing transactions at
the same time.

I still can't figure out how to make failure.trap() to work correctly
for me however. I'm trying to trap a mysqldb Operational exception,
but although the error is not further propagated after the trap call,
I get nothng in the return value.




More information about the Twisted-Python mailing list