(self, e: BaseException)
| 1920 | ) |
| 1921 | |
| 1922 | def _handle_request_exception(self, e: BaseException) -> None: |
| 1923 | if isinstance(e, Finish): |
| 1924 | # Not an error; just finish the request without logging. |
| 1925 | if not self._finished: |
| 1926 | self.finish(*e.args) |
| 1927 | return |
| 1928 | try: |
| 1929 | self.log_exception(*sys.exc_info()) |
| 1930 | except Exception: |
| 1931 | # An error here should still get a best-effort send_error() |
| 1932 | # to avoid leaking the connection. |
| 1933 | app_log.error("Error in exception logger", exc_info=True) |
| 1934 | if self._finished: |
| 1935 | # Extra errors after the request has been finished should |
| 1936 | # be logged, but there is no reason to continue to try and |
| 1937 | # send a response. |
| 1938 | return |
| 1939 | if isinstance(e, HTTPError): |
| 1940 | self.send_error(e.status_code, exc_info=sys.exc_info()) |
| 1941 | else: |
| 1942 | self.send_error(500, exc_info=sys.exc_info()) |
| 1943 | |
| 1944 | def log_exception( |
| 1945 | self, |
no test coverage detected