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

@@ -329,15 +329,12 @@ def test_request_stream_handle_exception(app):
# 404
request, response = app.test_client.post("/in_valid_post", data=data)
assert response.status == 404
assert response.text == "Error: Requested URL /in_valid_post not found"
assert "Requested URL /in_valid_post not found" in response.text
# 405
request, response = app.test_client.get("/post/random_id")
assert response.status == 405
assert (
response.text == "Error: Method GET not allowed for URL"
" /post/random_id"
)
assert "Method GET not allowed for URL /post/random_id" in response.text
def test_request_stream_blueprint(app):