mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
[1.5.x] [py3] Stopped iterating on exceptions. Refs #20025.
Backport of 86b4ac66 from master.
This commit is contained in:
parent
23b234a9d9
commit
b5d6a5b21a
@ -123,7 +123,7 @@ class CursorWrapper(object):
|
|||||||
except Database.OperationalError as e:
|
except Database.OperationalError as e:
|
||||||
# Map some error codes to IntegrityError, since they seem to be
|
# Map some error codes to IntegrityError, since they seem to be
|
||||||
# misclassified and Django would prefer the more logical place.
|
# misclassified and Django would prefer the more logical place.
|
||||||
if e[0] in self.codes_for_integrityerror:
|
if e.args[0] in self.codes_for_integrityerror:
|
||||||
six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
|
six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
|
||||||
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
|
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
|
||||||
except Database.DatabaseError as e:
|
except Database.DatabaseError as e:
|
||||||
@ -137,7 +137,7 @@ class CursorWrapper(object):
|
|||||||
except Database.OperationalError as e:
|
except Database.OperationalError as e:
|
||||||
# Map some error codes to IntegrityError, since they seem to be
|
# Map some error codes to IntegrityError, since they seem to be
|
||||||
# misclassified and Django would prefer the more logical place.
|
# misclassified and Django would prefer the more logical place.
|
||||||
if e[0] in self.codes_for_integrityerror:
|
if e.args[0] in self.codes_for_integrityerror:
|
||||||
six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
|
six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
|
||||||
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
|
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
|
||||||
except Database.DatabaseError as e:
|
except Database.DatabaseError as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user