This method is called whenever an exception occurs that should be handled. A special case is :class:`~werkzeug .exceptions.HTTPException` which is forwarded to the :meth:`handle_http_exception` method. This function will either return a response value or reraise the e
(
self, e: Exception
)
| 777 | return self.ensure_sync(handler)(e) # type: ignore[no-any-return] |
| 778 | |
| 779 | def handle_user_exception( |
| 780 | self, e: Exception |
| 781 | ) -> HTTPException | ft.ResponseReturnValue: |
| 782 | """This method is called whenever an exception occurs that |
| 783 | should be handled. A special case is :class:`~werkzeug |
| 784 | .exceptions.HTTPException` which is forwarded to the |
| 785 | :meth:`handle_http_exception` method. This function will either |
| 786 | return a response value or reraise the exception with the same |
| 787 | traceback. |
| 788 | |
| 789 | .. versionchanged:: 1.0 |
| 790 | Key errors raised from request data like ``form`` show the |
| 791 | bad key in debug mode rather than a generic bad request |
| 792 | message. |
| 793 | |
| 794 | .. versionadded:: 0.7 |
| 795 | """ |
| 796 | if isinstance(e, BadRequestKeyError) and ( |
| 797 | self.debug or self.config["TRAP_BAD_REQUEST_ERRORS"] |
| 798 | ): |
| 799 | e.show_exception = True |
| 800 | |
| 801 | if isinstance(e, HTTPException) and not self.trap_http_exception(e): |
| 802 | return self.handle_http_exception(e) |
| 803 | |
| 804 | handler = self._find_error_handler(e, request.blueprints) |
| 805 | |
| 806 | if handler is None: |
| 807 | raise |
| 808 | |
| 809 | return self.ensure_sync(handler)(e) # type: ignore[no-any-return] |
| 810 | |
| 811 | def handle_exception(self, e: Exception) -> Response: |
| 812 | """Handle an exception that did not have an error handler |
no test coverage detected