Log original exception in debug mode.
Sanic is collecting the information of original exceptions but does not print it on console. Because it is very useful to debug user code, it is better to be logged as debug logs.
This commit is contained in:
parent
73a57e1105
commit
683c0c1390
|
@ -217,6 +217,14 @@ class Sanic:
|
|||
# -------------------------------------------- #
|
||||
# Response Generation Failed
|
||||
# -------------------------------------------- #
|
||||
if self.debug:
|
||||
error_body = response.body
|
||||
if isinstance(error_body, bytes):
|
||||
try:
|
||||
error_body = error_body.decode()
|
||||
except:
|
||||
pass
|
||||
log.debug(error_body)
|
||||
|
||||
try:
|
||||
response = self.error_handler.response(request, e)
|
||||
|
|
Loading…
Reference in New Issue
Block a user