mirror of
https://github.com/django/django.git
synced 2025-10-30 17:16:10 +00:00
Fixed #19827 -- Kept stacktrace in defaulttags exception reraising
Thanks Kronuz for the report and the initial patch.
This commit is contained in:
committed by
Claude Paroz
parent
0ad76843b5
commit
687d2e967d
@@ -416,7 +416,8 @@ class URLNode(Node):
|
||||
url = ''
|
||||
try:
|
||||
url = reverse(view_name, args=args, kwargs=kwargs, current_app=context.current_app)
|
||||
except NoReverseMatch as e:
|
||||
except NoReverseMatch:
|
||||
exc_info = sys.exc_info()
|
||||
if settings.SETTINGS_MODULE:
|
||||
project_name = settings.SETTINGS_MODULE.split('.')[0]
|
||||
try:
|
||||
@@ -428,10 +429,10 @@ class URLNode(Node):
|
||||
# Re-raise the original exception, not the one with
|
||||
# the path relative to the project. This makes a
|
||||
# better error message.
|
||||
raise e
|
||||
six.reraise(*exc_info)
|
||||
else:
|
||||
if self.asvar is None:
|
||||
raise e
|
||||
raise
|
||||
|
||||
if self.asvar:
|
||||
context[self.asvar] = url
|
||||
|
||||
Reference in New Issue
Block a user