forked from orbit-oss/flask
remove redundant _register_error_handler
This commit is contained in:
parent
25ab05e6a2
commit
ef52e3e4a3
1 changed files with 2 additions and 11 deletions
|
|
@ -630,7 +630,7 @@ class Scaffold:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(f):
|
def decorator(f):
|
||||||
self._register_error_handler(None, code_or_exception, f)
|
self.register_error_handler(code_or_exception, f)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
|
@ -643,15 +643,6 @@ class Scaffold:
|
||||||
|
|
||||||
.. versionadded:: 0.7
|
.. versionadded:: 0.7
|
||||||
"""
|
"""
|
||||||
self._register_error_handler(None, code_or_exception, f)
|
|
||||||
|
|
||||||
@setupmethod
|
|
||||||
def _register_error_handler(self, key, code_or_exception, f):
|
|
||||||
"""
|
|
||||||
:type key: None|str
|
|
||||||
:type code_or_exception: int|T<=Exception
|
|
||||||
:type f: callable
|
|
||||||
"""
|
|
||||||
if isinstance(code_or_exception, HTTPException): # old broken behavior
|
if isinstance(code_or_exception, HTTPException): # old broken behavior
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Tried to register a handler for an exception instance"
|
"Tried to register a handler for an exception instance"
|
||||||
|
|
@ -668,7 +659,7 @@ class Scaffold:
|
||||||
" instead."
|
" instead."
|
||||||
)
|
)
|
||||||
|
|
||||||
self.error_handler_spec[key][code][exc_class] = f
|
self.error_handler_spec[None][code][exc_class] = f
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_exc_class_and_code(exc_class_or_code):
|
def _get_exc_class_and_code(exc_class_or_code):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue