[ZODB-Dev] API for dooming a transaction for ZODB 3.3

Steve Alexander steve at z3u.com
Mon Jan 12 06:46:28 EST 2004


> Does it make sense to allow doom to provide a nicer error? Perhaps an error 
> string (as a parameter to the doom method) that will get included in whatever 
> exception gets raised during commit. 

An informative string would be useful. What about passing in the
exception instead?

  exception = FooException('Too much foo!')
  get_transaction().doom(exception)
  raise exception

or even

  try:
      raise FooException('Too much foo!')
  except e:
      get_transaction().doom(e)
      raise

or even

  get_transaction().doom_and_raise(FooException('Too much foo!'))


Personally, I like the first example best.

> Have I overlooked a discussion of what that exception should be?

No. I slipped in to the conversation an idea to raise an exception
ConlictErrorOfDoom that derives from ConflictError, but I wasn't being
entirely serious.

The error isn't really a conflict error, although it can usually be
treated as one. Maybe a conflict error and a doomed transaction error
should have a common base-class? Then again, that approach has a chance
of being incompatible with existing applications.

--
Steve Alexander




More information about the ZODB-Dev mailing list