improved default handling
This commit is contained in:
parent
9e0747db15
commit
d9f6846c76
|
@ -28,9 +28,10 @@ class CustomHandler(Handler):
|
||||||
if not issubclass(type(exception), SanicException):
|
if not issubclass(type(exception), SanicException):
|
||||||
print(exception)
|
print(exception)
|
||||||
|
|
||||||
# Then, we must finish handling the exception by
|
# Then, we must finish handling the exception by returning
|
||||||
# returning our response to the client
|
# our response to the client
|
||||||
return text("An error occured", status=500)
|
# For this we can just call the super class' default handler
|
||||||
|
return super.default(self, request, exception)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,4 +57,4 @@ async def test(request):
|
||||||
return json({"test": True})
|
return json({"test": True})
|
||||||
|
|
||||||
|
|
||||||
app.run(host="0.0.0.0", port=8000)
|
app.run(host="0.0.0.0", port=8000, debug=True)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user