Register errorhandlers for Exceptions
Allow a default errorhandler by registering an errorhandler for HTTPException tests included
This commit is contained in:
parent
c8e56d5807
commit
668061a5fc
2 changed files with 34 additions and 2 deletions
11
flask/app.py
11
flask/app.py
|
|
@ -1484,7 +1484,16 @@ class Flask(_PackageBoundObject):
|
|||
return handler
|
||||
|
||||
# fall back to app handlers
|
||||
return find_handler(self.error_handler_spec[None].get(code))
|
||||
handler = find_handler(self.error_handler_spec[None].get(code))
|
||||
if handler is not None:
|
||||
return handler
|
||||
|
||||
try:
|
||||
handler = find_handler(self.error_handler_spec[None][None])
|
||||
except KeyError:
|
||||
handler = None
|
||||
|
||||
return handler
|
||||
|
||||
def handle_http_exception(self, e):
|
||||
"""Handles an HTTP exception. By default this will invoke the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue