summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2017-04-25 08:29:54 +0200
committerGitHub <noreply@github.com>2017-04-25 08:29:54 +0200
commit84dcd1624784c2239f96a97b3151145a85dfbbe3 (patch)
tree5ab657beddf3ec64a5d9b98d2a8eb51022a4b8df
parent562bca67b9a3509f7c9806c7051398ad775e8e09 (diff)
Refs #23919 -- Used "raise from" instead of __cause__ in reraising backend-specific database exceptions.
Thanks Tim Graham for the review.
-rw-r--r--django/db/utils.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/django/db/utils.py b/django/db/utils.py
index 6c9b489040..d5174682e1 100644
--- a/django/db/utils.py
+++ b/django/db/utils.py
@@ -82,12 +82,11 @@ class DatabaseErrorWrapper:
db_exc_type = getattr(self.wrapper.Database, dj_exc_type.__name__)
if issubclass(exc_type, db_exc_type):
dj_exc_value = dj_exc_type(*exc_value.args)
- dj_exc_value.__cause__ = exc_value
# Only set the 'errors_occurred' flag for errors that may make
# the connection unusable.
if dj_exc_type not in (DataError, IntegrityError):
self.wrapper.errors_occurred = True
- raise dj_exc_value.with_traceback(traceback)
+ raise dj_exc_value.with_traceback(traceback) from exc_value
def __call__(self, func):
# Note that we are intentionally not using @wraps here for performance