Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Increased robustness of 58161e4. Refs #22291.

  • Loading branch information...
commit ee837b9a22220d08fea1e499bec3b094851a1bbe 1 parent 8176150
Aymeric Augustin aaugustin authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 django/db/transaction.py
10 django/db/transaction.py
View
@@ -217,7 +217,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
@@ -243,7 +249,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.
Please sign in to comment.
Something went wrong with that request. Please try again.