commit
ab97018c78
10
sanic/app.py
10
sanic/app.py
|
@ -577,13 +577,17 @@ class Sanic:
|
||||||
if isawaitable(response):
|
if isawaitable(response):
|
||||||
response = await response
|
response = await response
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if self.debug:
|
if isinstance(e, SanicException):
|
||||||
|
response = self.error_handler.default(request=request,
|
||||||
|
exception=e)
|
||||||
|
elif self.debug:
|
||||||
response = HTTPResponse(
|
response = HTTPResponse(
|
||||||
"Error while handling error: {}\nStack: {}".format(
|
"Error while handling error: {}\nStack: {}".format(
|
||||||
e, format_exc()))
|
e, format_exc()), status=500)
|
||||||
else:
|
else:
|
||||||
response = HTTPResponse(
|
response = HTTPResponse(
|
||||||
"An error occurred while handling an error")
|
"An error occurred while handling an error",
|
||||||
|
status=500)
|
||||||
finally:
|
finally:
|
||||||
# -------------------------------------------- #
|
# -------------------------------------------- #
|
||||||
# Response Middleware
|
# Response Middleware
|
||||||
|
|
Loading…
Reference in New Issue
Block a user