diff options
| author | Giebisch <rafael@giebisch-mail.de> | 2022-11-21 16:54:57 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-11-25 08:16:10 +0100 |
| commit | 80c66e40f7beecbd5ee501f757a2e61236597349 (patch) | |
| tree | 26d3bc257e6f379894a103406a7e80d9dd3f953d /django | |
| parent | 70c945d6b31b41b320e57088702077864428fdc0 (diff) | |
Fixed #33747 -- Added exception notes to the technical 500 debug page.
Diffstat (limited to 'django')
| -rw-r--r-- | django/views/debug.py | 2 | ||||
| -rw-r--r-- | django/views/templates/technical_500.html | 4 | ||||
| -rw-r--r-- | django/views/templates/technical_500.txt | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/django/views/debug.py b/django/views/debug.py index 30a1dbc6da..b93afa5737 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -396,6 +396,8 @@ class ExceptionReporter: c["exception_type"] = self.exc_type.__name__ if self.exc_value: c["exception_value"] = str(self.exc_value) + if exc_notes := getattr(self.exc_value, "__notes__", None): + c["exception_notes"] = "\n" + "\n".join(exc_notes) if frames: c["lastframe"] = frames[-1] return c diff --git a/django/views/templates/technical_500.html b/django/views/templates/technical_500.html index 4483145ec3..ae0411729a 100644 --- a/django/views/templates/technical_500.html +++ b/django/views/templates/technical_500.html @@ -100,7 +100,7 @@ <div id="summary"> <h1>{% if exception_type %}{{ exception_type }}{% else %}Report{% endif %} {% if request %} at {{ request.path_info }}{% endif %}</h1> - <pre class="exception_value">{% if exception_value %}{{ exception_value|force_escape }}{% else %}No exception message supplied{% endif %}</pre> + <pre class="exception_value">{% if exception_value %}{{ exception_value|force_escape }}{% if exception_notes %}{{ exception_notes }}{% endif %}{% else %}No exception message supplied{% endif %}</pre> <table class="meta"> {% if request %} <tr> @@ -330,7 +330,7 @@ During handling of the above exception ({{ frame.exc_cause|force_escape }}), ano {% if frame.context_line %} {% spaceless %}{{ frame.context_line }}{% endspaceless %}{% endif %}{% elif forloop.first %}None{% else %}Traceback: None{% endif %}{% endfor %} Exception Type: {{ exception_type }}{% if request %} at {{ request.path_info }}{% endif %} -Exception Value: {{ exception_value|force_escape }} +Exception Value: {{ exception_value|force_escape }}{% if exception_notes %}{{ exception_notes }}{% endif %} </textarea> <br><br> <input type="submit" value="Share this traceback on a public website"> diff --git a/django/views/templates/technical_500.txt b/django/views/templates/technical_500.txt index 87cf6b5bbc..a481c5db0d 100644 --- a/django/views/templates/technical_500.txt +++ b/django/views/templates/technical_500.txt @@ -34,7 +34,7 @@ Traceback (most recent call last): {% if frame.context_line %} {% spaceless %}{{ frame.context_line }}{% endspaceless %}{% endif %}{% elif forloop.first %}None{% else %}Traceback: None{% endif %} {% endfor %} {% if exception_type %}Exception Type: {{ exception_type }}{% if request %} at {{ request.path_info }}{% endif %} -{% if exception_value %}Exception Value: {{ exception_value }}{% endif %}{% endif %}{% endif %} +{% if exception_value %}Exception Value: {{ exception_value }}{% endif %}{% if exception_notes %}{{ exception_notes }}{% endif %}{% endif %}{% endif %} {% if raising_view_name %}Raised during: {{ raising_view_name }}{% endif %} {% if request %}Request information: {% if user_str %}USER: {{ user_str }}{% endif %} |
