1
0
mirror of https://github.com/django/django.git synced 2025-10-26 23:26:08 +00:00

Fixed #18003 -- Preserved tracebacks when re-raising errors.

Thanks jrothenbuhler for draft patch, Konark Modi for updates.
This commit is contained in:
konarkmodi
2013-03-19 10:34:59 +05:30
committed by Carl Meyer
parent 1fe90b281b
commit bc4111ba68
15 changed files with 60 additions and 32 deletions

View File

@@ -8,6 +8,7 @@ from __future__ import unicode_literals
import base64
import cgi
import sys
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
@@ -209,7 +210,8 @@ class MultiPartParser(object):
chunk = base64.b64decode(chunk)
except Exception as e:
# Since this is only a chunk, any error is an unfixable error.
raise MultiPartParserError("Could not decode base64 data: %r" % e)
msg = "Could not decode base64 data: %r" % e
six.reraise(MultiPartParserError, MultiPartParserError(msg), sys.exc_info()[2])
for i, handler in enumerate(handlers):
chunk_length = len(chunk)