fix
This commit is contained in:
parent
43c5a4bb60
commit
3f0e662358
|
@ -43,3 +43,11 @@ Some of the most useful exceptions are presented below:
|
||||||
usually occurs if there is an exception raised in user code.
|
usually occurs if there is an exception raised in user code.
|
||||||
|
|
||||||
See the `sanic.exceptions` module for the full list of exceptions to throw.
|
See the `sanic.exceptions` module for the full list of exceptions to throw.
|
||||||
|
|
||||||
|
You can also use `exceptions_base`, it can catch the exception just like
|
||||||
|
normal catching. It can be used for catching all unexpected error and eliminate
|
||||||
|
the risk that server information being stolen by attackers/
|
||||||
|
|
||||||
|
@app.exception_base(Exception)
|
||||||
|
def catch_everything(request, exception):
|
||||||
|
return text( "Server Error!",500)
|
||||||
|
|
|
@ -18,6 +18,7 @@ from sanic.response import text, html
|
||||||
|
|
||||||
class ErrorHandler:
|
class ErrorHandler:
|
||||||
handlers = None
|
handlers = None
|
||||||
|
handlers_base = None
|
||||||
cached_handlers = None
|
cached_handlers = None
|
||||||
_missing = object()
|
_missing = object()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user