remove redundant _register_error_handler

This commit is contained in:
David Lord 2021-03-10 10:11:26 -08:00
parent 25ab05e6a2
commit ef52e3e4a3
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8

View file

@ -630,7 +630,7 @@ class Scaffold:
"""
def decorator(f):
self._register_error_handler(None, code_or_exception, f)
self.register_error_handler(code_or_exception, f)
return f
return decorator
@ -643,15 +643,6 @@ class Scaffold:
.. 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
raise ValueError(
"Tried to register a handler for an exception instance"
@ -668,7 +659,7 @@ class Scaffold:
" instead."
)
self.error_handler_spec[key][code][exc_class] = f
self.error_handler_spec[None][code][exc_class] = f
@staticmethod
def _get_exc_class_and_code(exc_class_or_code):