forked from orbit-oss/flask
Removed 500 not being registerable for blueprints
This commit is contained in:
parent
aa4700c276
commit
0e44cca8e3
1 changed files with 1 additions and 15 deletions
16
flask/app.py
16
flask/app.py
|
|
@ -1211,22 +1211,8 @@ class Flask(_PackageBoundObject):
|
||||||
'Handlers can only be registered for exception classes or HTTP error codes.'
|
'Handlers can only be registered for exception classes or HTTP error codes.'
|
||||||
.format(code_or_exception))
|
.format(code_or_exception))
|
||||||
|
|
||||||
code = code_or_exception
|
|
||||||
is_code = isinstance(code_or_exception, integer_types)
|
|
||||||
if not is_code:
|
|
||||||
if issubclass(code_or_exception, HTTPException):
|
|
||||||
code = code_or_exception.code
|
|
||||||
else:
|
|
||||||
code = None
|
|
||||||
|
|
||||||
handlers = self.error_handler_spec.setdefault(key, ExceptionHandlerDict(self, key))
|
handlers = self.error_handler_spec.setdefault(key, ExceptionHandlerDict(self, key))
|
||||||
|
|
||||||
if is_code:
|
|
||||||
# TODO: why is this?
|
|
||||||
assert code != 500 or key is None, \
|
|
||||||
'It is currently not possible to register a 500 internal ' \
|
|
||||||
'server error on a per-blueprint level.'
|
|
||||||
|
|
||||||
handlers[code_or_exception] = f
|
handlers[code_or_exception] = f
|
||||||
|
|
||||||
@setupmethod
|
@setupmethod
|
||||||
|
|
@ -1551,7 +1537,7 @@ class Flask(_PackageBoundObject):
|
||||||
exc_type, exc_value, tb = sys.exc_info()
|
exc_type, exc_value, tb = sys.exc_info()
|
||||||
|
|
||||||
got_request_exception.send(self, exception=e)
|
got_request_exception.send(self, exception=e)
|
||||||
handler = self.error_handler_spec[None].get(500)
|
handler = self._find_error_handler(InternalServerError())
|
||||||
|
|
||||||
if self.propagate_exceptions:
|
if self.propagate_exceptions:
|
||||||
# if we want to repropagate the exception, we can attempt to
|
# if we want to repropagate the exception, we can attempt to
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue