Skip to content

Commit

Permalink
forgot to add class name as requested by Jim
Browse files Browse the repository at this point in the history
  • Loading branch information
agroszer committed May 21, 2015
1 parent 0a7ee5c commit 904300f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/ZODB/ConflictResolution.py
Expand Up @@ -239,6 +239,7 @@ def persistent_id(object):
def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle,
committedData=b''):
# class_tuple, old, committed, newstate = ('',''), 0, 0, 0
klass = 'n/a'
try:
prfactory = PersistentReferenceFactory()
newpickle = self._crs_untransform_record_data(newpickle)
Expand Down Expand Up @@ -295,15 +296,17 @@ def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle,
pickler.dump(resolved)
return self._crs_transform_record_data(file.getvalue())
except (ConflictError, BadClassName) as e:
logger.debug("Conflict resolution failed with %s: %s" % (
e.__class__.__name__, str(e)))
logger.debug(
"Conflict resolution on %s failed with %s: %s",
klass, e.__class__.__name__, str(e))
except:
# If anything else went wrong, catch it here and avoid passing an
# arbitrary exception back to the client. The error here will mask
# the original ConflictError. A client can recover from a
# ConflictError, but not necessarily from other errors. But log
# the error so that any problems can be fixed.
logger.exception("Unexpected error")
logger.exception(
"Unexpected error while trying to resolve conflict on %s", klass)

raise ConflictError(oid=oid, serials=(committedSerial, oldSerial),
data=newpickle)
Expand Down
5 changes: 2 additions & 3 deletions src/ZODB/tests/testconflictresolution.py
Expand Up @@ -355,11 +355,11 @@ def show_tryToResolveConflict_log_output():
>>> msg = handler.records[0]
>>> six.print_(msg.name, msg.levelname, msg.getMessage())
ZODB.ConflictResolution ERROR Unexpected error
ZODB.ConflictResolution ERROR Unexpected error while trying to resolve conflict on <class 'ZODB.tests.testconflictresolution.FailHard'>
>>> msg = handler.records[1]
>>> six.print_(msg.name, msg.levelname, msg.getMessage())
ZODB.ConflictResolution DEBUG Conflict resolution failed with ConflictError: database conflict error
ZODB.ConflictResolution DEBUG Conflict resolution on <class 'ZODB.tests.testconflictresolution.Unresolvable'> failed with ConflictError: database conflict error
Cleanup:
Expand All @@ -381,4 +381,3 @@ def test_suite():
setUp=setUp, tearDown=tearDown,
checker=ZODB.tests.util.checker),
])

0 comments on commit 904300f

Please sign in to comment.