First, you should not - ever - catch a ConflictError. It is essential for ConflictErrors to be propagated to the ZPublisher.

Second, the conflict is detected at commit time, which happens at the very end of the REQUEST. This likely is a while after your method has executed.

Stefan


On 4. Jul 2006, at 15:56, Jonathan wrote:

I am trying to trap the following error:

Traceback (innermost last):
  Module Zope2.App.startup, line 173, in zpublisher_exception_hook
  Module ZPublisher.Publish, line 121, in publish
  Module Zope2.App.startup, line 240, in commit
  Module transaction._manager, line 96, in commit
  Module transaction._transaction, line 380, in commit
  Module transaction._transaction, line 378, in commit
  Module transaction._transaction, line 433, in _commitResources
  Module ZODB.Connection, line 484, in commit
  Module ZODB.Connection, line 526, in _commit
  Module ZODB.Connection, line 554, in _store_objects
  Module tempstorage.TemporaryStorage, line 200, in store
ConflictError: database conflict error (oid 0x39b0, class BTrees._OOBTree.OOBucket, serial this txn started with 0x0366974da4fd2288 2006-07-04 13:33:38.669252, serial currently committed 0x0366974da54d9fcc 2006-07-04 13:33:38.742942)


in an external method, as follows:

        folder = self.unrestrictedTraverse(TEMPFOLDERIMAGES, None)
        try:
                folder.manage_addImage(imageId, imageData)
        except:
                <handle error message and return gracefully code>


But the try/except block is not catching the error! (the error continues to show up in error_log) (note: I started by trying "except ConflictError:", but that was not working, so I went to the bare try/except)

The traceback does not show where the error originates in the external method, but there is only one place where the external methods writes to TemporaryStorage. Does this indicate that the error is not bubbling up properly?

Any ideas as to why the error trapping is not trapping? (running Zope 2.9.2, debug=on)

--
Anything that, in happening, causes something else to happen,
causes something else to happen.  --Douglas Adams


_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to