(self, e: BaseException)
| 1753 | ) |
| 1754 | |
| 1755 | def _handle_request_exception(self, e: BaseException) -> None: |
| 1756 | if isinstance(e, Finish): |
| 1757 | # Not an error; just finish the request without logging. |
| 1758 | if not self._finished: |
| 1759 | self.finish(*e.args) |
| 1760 | return |
| 1761 | try: |
| 1762 | self.log_exception(*sys.exc_info()) |
| 1763 | except Exception: |
| 1764 | # An error here should still get a best-effort send_error() |
| 1765 | # to avoid leaking the connection. |
| 1766 | app_log.error("Error in exception logger", exc_info=True) |
| 1767 | if self._finished: |
| 1768 | # Extra errors after the request has been finished should |
| 1769 | # be logged, but there is no reason to continue to try and |
| 1770 | # send a response. |
| 1771 | return |
| 1772 | if isinstance(e, HTTPError): |
| 1773 | self.send_error(e.status_code, exc_info=sys.exc_info()) |
| 1774 | else: |
| 1775 | self.send_error(500, exc_info=sys.exc_info()) |
| 1776 | |
| 1777 | def log_exception( |
| 1778 | self, |
no test coverage detected