Return a registered error handler for an exception in this order: blueprint handler for a specific code, app handler for a specific code, blueprint handler for an exception class, app handler for an exception class, or ``None`` if a suitable handler is not found.
(
self, e: Exception, blueprints: list[str]
)
| 821 | return f |
| 822 | |
| 823 | def _find_error_handler( |
| 824 | self, e: Exception, blueprints: list[str] |
| 825 | ) -> ft.ErrorHandlerCallable | None: |
| 826 | """Return a registered error handler for an exception in this order: |
| 827 | blueprint handler for a specific code, app handler for a specific code, |
| 828 | blueprint handler for an exception class, app handler for an exception |
| 829 | class, or ``None`` if a suitable handler is not found. |
| 830 | """ |
| 831 | exc_class, code = self._get_exc_class_and_code(type(e)) |
| 832 | names = (*blueprints, None) |
| 833 | |
| 834 | for c in (code, None) if code is not None else (None,): |
| 835 | for name in names: |
| 836 | handler_map = self.error_handler_spec[name][c] |
| 837 | |
| 838 | if not handler_map: |
| 839 | continue |
| 840 | |
| 841 | for cls in exc_class.__mro__: |
| 842 | handler = handler_map.get(cls) |
| 843 | |
| 844 | if handler is not None: |
| 845 | return handler |
| 846 | return None |
| 847 | |
| 848 | def trap_http_exception(self, e: Exception) -> bool: |
| 849 | """Checks if an HTTP exception should be trapped or not. By default |
no test coverage detected