forked from orbit-oss/flask
Merge remote-tracking branch 'origin/1.0-maintenance'
This commit is contained in:
commit
a74864ec22
5 changed files with 39 additions and 4 deletions
19
flask/app.py
19
flask/app.py
|
|
@ -20,7 +20,8 @@ from threading import Lock
|
|||
from werkzeug.datastructures import Headers, ImmutableDict
|
||||
from werkzeug.exceptions import BadRequest, BadRequestKeyError, HTTPException, \
|
||||
InternalServerError, MethodNotAllowed, default_exceptions
|
||||
from werkzeug.routing import BuildError, Map, RequestRedirect, Rule
|
||||
from werkzeug.routing import BuildError, Map, RequestRedirect, \
|
||||
RoutingException, Rule
|
||||
|
||||
from . import cli, json
|
||||
from ._compat import integer_types, reraise, string_types, text_type
|
||||
|
|
@ -1631,6 +1632,16 @@ class Flask(_PackageBoundObject):
|
|||
registered error handlers and fall back to returning the
|
||||
exception as response.
|
||||
|
||||
.. versionchanged:: 1.0.3
|
||||
``RoutingException``, used internally for actions such as
|
||||
slash redirects during routing, is not passed to error
|
||||
handlers.
|
||||
|
||||
.. versionchanged:: 1.0
|
||||
Exceptions are looked up by code *and* by MRO, so
|
||||
``HTTPExcpetion`` subclasses can be handled with a catch-all
|
||||
handler for the base ``HTTPException``.
|
||||
|
||||
.. versionadded:: 0.3
|
||||
"""
|
||||
# Proxy exceptions don't have error codes. We want to always return
|
||||
|
|
@ -1638,6 +1649,12 @@ class Flask(_PackageBoundObject):
|
|||
if e.code is None:
|
||||
return e
|
||||
|
||||
# RoutingExceptions are used internally to trigger routing
|
||||
# actions, such as slash redirects raising RequestRedirect. They
|
||||
# are not raised or handled in user code.
|
||||
if isinstance(e, RoutingException):
|
||||
return e
|
||||
|
||||
handler = self._find_error_handler(e)
|
||||
if handler is None:
|
||||
return e
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue