Increased robustness of 58161e4e. Refs #22291.

This commit is contained in:
Aymeric Augustin 2014-04-10 21:14:50 +02:00
parent 8176150850
commit ee837b9a22
1 changed files with 8 additions and 2 deletions

View File

@ -217,7 +217,13 @@ class Atomic(object):
try:
connection.savepoint_commit(sid)
except DatabaseError:
connection.savepoint_rollback(sid)
try:
connection.savepoint_rollback(sid)
except Error:
# If rolling back to a savepoint fails, mark for
# rollback at a higher level and avoid shadowing
# the original exception.
connection.needs_rollback = True
raise
else:
# Commit transaction
@ -243,7 +249,7 @@ class Atomic(object):
else:
try:
connection.savepoint_rollback(sid)
except DatabaseError:
except Error:
# If rolling back to a savepoint fails, mark for
# rollback at a higher level and avoid shadowing
# the original exception.