[Zope3-checkins] CVS: ZODB/src/transaction - _transaction.py:1.4

Tim Peters tim.one at comcast.net
Mon Apr 5 21:06:42 EDT 2004


Update of /cvs-repository/ZODB/src/transaction
In directory cvs.zope.org:/tmp/cvs-serv5968/src/transaction

Modified Files:
	_transaction.py 
Log Message:
_commitResources() and _cleanup():  When an exception occurs during
the former, remember it and raise it after calling _cleanup.  If
abort_sub() or tpc_abort() in _cleanup() also raise exceptions, log
them but don't propagate them.

This stops stray output produced by tests testExceptionInTpcAbort and
testExceptionInSubAbortSub.

Grrrrr:  I haven't yet been able to figure out how to get logging to work
in ZODB, so haven't yet been able to check that the new logging is
reasonable.


=== ZODB/src/transaction/_transaction.py 1.3 => 1.4 ===
--- ZODB/src/transaction/_transaction.py:1.3	Fri Apr  2 14:48:23 2004
+++ ZODB/src/transaction/_transaction.py	Mon Apr  5 21:06:41 2004
@@ -305,6 +305,7 @@
             # to revert the changes in each of the resource managers.
             # For top-level transactions, it must be freed from the
             # txn manager.
+            t, v, tb = sys.exc_info()
             try:
                 self._cleanup(L)
             finally:
@@ -312,7 +313,7 @@
                     self.status = Status.FAILED
                     if self._manager:
                         self._manager.free(self)
-            raise
+            raise t, v, tb
 
     def _cleanup(self, L):
         # Called when an exception occurs during tpc_vote or tpc_finish.
@@ -323,15 +324,15 @@
             if id(rm) in self._sub:
                 try:
                     rm.abort_sub(self)
-                except Exception, err:
-                    # XXX Just printing the error doesn't seem good enough.
-                    print err
+                except Exception:
+                    self.log.error("Error in abort_sub() on manager %s",
+                                   rm, exc_info=sys.exc_info())
             else:
                 try:
                     rm.tpc_abort(self)
-                except Exception, err:
-                    # XXX Just printing the error doesn't seem good enough.
-                    print err
+                except Exception:
+                    self.log.error("Error in tpc_abort() on manager %s",
+                                   rm, exc_info=sys.exc_info())
 
     def _getResourceManagers(self, subtransaction):
         L = []




More information about the Zope3-Checkins mailing list