Skip to content
Myr

remove redundant _register_error_handler

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 25ab05e · Browse files · 1 file+2 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−11 removed

  • other:+2 added−11 removed

1 file+2 added−11 removed

modified:src/flask/scaffold.py+2 added-11 removed
628 unmodified lines
629 an arbitrary exception630 """631632 def decorator(f):633 self._register_error_handler(None, code_or_exception, f)633 self.register_error_handler(code_or_exception, f)634 return f635636 return decorator637
4 unmodified lines
642 usage.643644 .. versionadded:: 0.7645 """646 self._register_error_handler(None, code_or_exception, f)647648 @setupmethod649 def _register_error_handler(self, key, code_or_exception, f):650 """651 :type key: None|str652 :type code_or_exception: int|T<=Exception653 :type f: callable654 """646 if isinstance(code_or_exception, HTTPException): # old broken behavior647 raise ValueError(648 "Tried to register a handler for an exception instance"649 f" {code_or_exception!r}. Handlers can only be"
8 unmodified lines
658 " code. Use a subclass of HTTPException with that code"659 " instead."660 )661671 self.error_handler_spec[key][code][exc_class] = f662 self.error_handler_spec[None][code][exc_class] = f663664 @staticmethod665 def _get_exc_class_and_code(exc_class_or_code):666 """Get the exception class being handled. For HTTP status codes
195 unmodified lines