Path 1: 65 calls (0.51)

MethodNotAllowed (15) ZeroDivisionError (11) NotFound (11) InternalServerError (8) BadRequest (6) BadRequestKeyError (3) Exception (2) TestGenericHand...

None (65)

1def _find_error_handler(self, e: Exception) -> ft.ErrorHandlerCallable | None:
2        """Return a registered error handler for an exception in this order:
3        blueprint handler for a specific code, app handler for a specific code,
4        blueprint handler for an exception class, app handler for an exception
5        class, or ``None`` if a suitable handler is not found.
6        """
7        exc_class, code = self._get_exc_class_and_code(type(e))
8        names = (*request.blueprints, None)
9
10        for c in (code, None) if code is not None else (None,):
11            for name in names:
12                handler_map = self.error_handler_spec[name][c]
13
14                if not handler_map:
15                    continue
16
17                for cls in exc_class.__mro__:
18                    handler = handler_map.get(cls)
19
20                    if handler is not None:
21                        return handler
22        return None
            

Path 2: 50 calls (0.39)

InternalServerError (16) Forbidden (13) NotFound (2) Exception (1) AppError (1) BlueprintError (1) test_user_error_handling..MyException (1) t...

TestGenericHandlers.test_handle_class_or_code..handle_500 def (8) test_http_error_subclass_handling..handle_403 def (2) test_error_han...

1def _find_error_handler(self, e: Exception) -> ft.ErrorHandlerCallable | None:
2        """Return a registered error handler for an exception in this order:
3        blueprint handler for a specific code, app handler for a specific code,
4        blueprint handler for an exception class, app handler for an exception
5        class, or ``None`` if a suitable handler is not found.
6        """
7        exc_class, code = self._get_exc_class_and_code(type(e))
8        names = (*request.blueprints, None)
9
10        for c in (code, None) if code is not None else (None,):
11            for name in names:
12                handler_map = self.error_handler_spec[name][c]
13
14                if not handler_map:
15                    continue
16
17                for cls in exc_class.__mro__:
18                    handler = handler_map.get(cls)
19
20                    if handler is not None:
21                        return handler
22        return None
            

Path 3: 10 calls (0.08)

NotFound (4) Forbidden (3) InternalServerError (3)

TestGenericHandlers.test_handle_generic_http..handle_http def (3) TestGenericHandlers.test_handle_generic..handle_exception def (2) te...

1def _find_error_handler(self, e: Exception) -> ft.ErrorHandlerCallable | None:
2        """Return a registered error handler for an exception in this order:
3        blueprint handler for a specific code, app handler for a specific code,
4        blueprint handler for an exception class, app handler for an exception
5        class, or ``None`` if a suitable handler is not found.
6        """
7        exc_class, code = self._get_exc_class_and_code(type(e))
8        names = (*request.blueprints, None)
9
10        for c in (code, None) if code is not None else (None,):
11            for name in names:
12                handler_map = self.error_handler_spec[name][c]
13
14                if not handler_map:
15                    continue
16
17                for cls in exc_class.__mro__:
18                    handler = handler_map.get(cls)
19
20                    if handler is not None:
21                        return handler
22        return None
            

Path 4: 2 calls (0.02)

KeyError (2)

None (2)

1def _find_error_handler(self, e: Exception) -> ft.ErrorHandlerCallable | None:
2        """Return a registered error handler for an exception in this order:
3        blueprint handler for a specific code, app handler for a specific code,
4        blueprint handler for an exception class, app handler for an exception
5        class, or ``None`` if a suitable handler is not found.
6        """
7        exc_class, code = self._get_exc_class_and_code(type(e))
8        names = (*request.blueprints, None)
9
10        for c in (code, None) if code is not None else (None,):
11            for name in names:
12                handler_map = self.error_handler_spec[name][c]
13
14                if not handler_map:
15                    continue
16
17                for cls in exc_class.__mro__:
18                    handler = handler_map.get(cls)
19
20                    if handler is not None:
21                        return handler
22        return None