Browse files

[1.6.x] Increased robustness of 58161e4. Refs #22291.

Backport of ee837b9 from master
  • Loading branch information...
1 parent 1d3d2b9 commit 80f6cbbadbd33574c8b949a8fbc77a5e94398e54 @aaugustin aaugustin committed Apr 10, 2014
Showing with 8 additions and 2 deletions.
  1. +8 −2 django/db/transaction.py
View
10 django/db/transaction.py
@@ -302,7 +302,13 @@ def __exit__(self, exc_type, exc_value, traceback):
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
@@ -328,7 +334,7 @@ def __exit__(self, exc_type, exc_value, traceback):
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.

0 comments on commit 80f6cbb

Please sign in to comment.