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:
committed by
Stephen Sadowski
parent
b565072ed9
commit
ba9b432993
@@ -105,10 +105,7 @@ def test_app_handle_request_handler_is_none(app, monkeypatch):
|
||||
|
||||
request, response = app.test_client.get("/test")
|
||||
|
||||
assert (
|
||||
response.text
|
||||
== "Error: 'None' was returned while requesting a handler from the router"
|
||||
)
|
||||
assert "'None' was returned while requesting a handler from the router" in response.text
|
||||
|
||||
|
||||
@pytest.mark.parametrize("websocket_enabled", [True, False])
|
||||
@@ -189,7 +186,7 @@ def test_handle_request_with_nested_sanic_exception(app, monkeypatch, caplog):
|
||||
with caplog.at_level(logging.ERROR):
|
||||
request, response = app.test_client.get("/")
|
||||
assert response.status == 500
|
||||
assert response.text == "Error: Mock SanicException"
|
||||
assert "Mock SanicException" in response.text
|
||||
assert (
|
||||
"sanic.root",
|
||||
logging.ERROR,
|
||||
|
||||
Reference in New Issue
Block a user