No tracebacks on normal errors and prettier error pages (#1768)

* Default error handler now only logs traceback on 500 errors and all responses are HTML formatted.

* Tests passing.

* Ability to flag any exception object with self.quiet = True following @ashleysommer suggestion.

* Refactor HTML formatting into errorpages.py. String escapes for debug tracebacks.

* Remove extra includes

* Auto-set quiet flag also when decorator is used.

* Cleanup, make error pages (probably) HTML5-compliant and similar for debug and non-debug modes.

* Fix lookup of non-existant status codes

* No logging of 503 errors after all.

* lint
This commit is contained in:
L. Kärkkäinen
2020-01-20 16:58:14 +02:00
committed by Stephen Sadowski
parent b565072ed9
commit ba9b432993
14 changed files with 164 additions and 213 deletions

View File

@@ -86,7 +86,7 @@ def test_html_traceback_output_in_debug_mode():
summary_text = " ".join(soup.select(".summary")[0].text.split())
assert (
"NameError: name 'bar' " "is not defined while handling path /4"
"NameError: name 'bar' is not defined while handling path /4"
) == summary_text
@@ -112,7 +112,7 @@ def test_chained_exception_handler():
summary_text = " ".join(soup.select(".summary")[0].text.split())
assert (
"ZeroDivisionError: division by zero " "while handling path /6/0"
"ZeroDivisionError: division by zero while handling path /6/0"
) == summary_text