From: Ben Darnell Date: Fri, 31 May 2013 23:30:37 +0000 (-0400) Subject: Remove logging of uncaught exceptions from SimpleAsyncHTTPClient. X-Git-Tag: v3.1.0~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd4d8997a772829b8439322dbce45091bc51beaf;p=thirdparty%2Ftornado.git Remove logging of uncaught exceptions from SimpleAsyncHTTPClient. This logging was basically redundant since the exception is still made available to the caller through the response's error object. Closes #815. --- diff --git a/tornado/simple_httpclient.py b/tornado/simple_httpclient.py index 16874e036..d8dbb271a 100644 --- a/tornado/simple_httpclient.py +++ b/tornado/simple_httpclient.py @@ -312,7 +312,6 @@ class _HTTPConnection(object): def _handle_exception(self, typ, value, tb): if self.final_callback: self._remove_timeout() - gen_log.warning("uncaught exception", exc_info=(typ, value, tb)) self._run_callback(HTTPResponse(self.request, 599, error=value, request_time=self.io_loop.time() - self.start_time, )) diff --git a/tornado/test/simple_httpclient_test.py b/tornado/test/simple_httpclient_test.py index a2e57fb45..0d6d001d6 100644 --- a/tornado/test/simple_httpclient_test.py +++ b/tornado/test/simple_httpclient_test.py @@ -205,8 +205,7 @@ class SimpleHTTPClientTestMixin(object): @skipOnTravis def test_request_timeout(self): - with ExpectLog(gen_log, "uncaught exception"): - response = self.fetch('/trigger?wake=false', request_timeout=0.1) + response = self.fetch('/trigger?wake=false', request_timeout=0.1) self.assertEqual(response.code, 599) self.assertTrue(0.099 < response.request_time < 0.15, response.request_time) self.assertEqual(str(response.error), "HTTP 599: Timeout") @@ -226,9 +225,8 @@ class SimpleHTTPClientTestMixin(object): url = self.get_url("/hello").replace("localhost", "[::1]") # ipv6 is currently disabled by default and must be explicitly requested - with ExpectLog(gen_log, "uncaught exception"): - self.http_client.fetch(url, self.stop) - response = self.wait() + self.http_client.fetch(url, self.stop) + response = self.wait() self.assertEqual(response.code, 599) self.http_client.fetch(url, self.stop, allow_ipv6=True) @@ -241,11 +239,10 @@ class SimpleHTTPClientTestMixin(object): response = self.fetch("/content_length?value=2,%202,2") self.assertEqual(response.body, b"ok") - with ExpectLog(gen_log, "uncaught exception"): - response = self.fetch("/content_length?value=2,4") - self.assertEqual(response.code, 599) - response = self.fetch("/content_length?value=2,%202,3") - self.assertEqual(response.code, 599) + response = self.fetch("/content_length?value=2,4") + self.assertEqual(response.code, 599) + response = self.fetch("/content_length?value=2,%202,3") + self.assertEqual(response.code, 599) def test_head_request(self): response = self.fetch("/head", method="HEAD") @@ -268,9 +265,8 @@ class SimpleHTTPClientTestMixin(object): self.assertEqual(response.headers["Content-length"], "0") # 204 status with non-zero content length is malformed - with ExpectLog(gen_log, "uncaught exception"): - response = self.fetch("/no_content?error=1") - self.assertEqual(response.code, 599) + response = self.fetch("/no_content?error=1") + self.assertEqual(response.code, 599) def test_host_header(self): host_re = re.compile(b"^localhost:[0-9]+$") @@ -285,9 +281,8 @@ class SimpleHTTPClientTestMixin(object): def test_connection_refused(self): server_socket, port = bind_unused_port() server_socket.close() - with ExpectLog(gen_log, ".*"): - self.http_client.fetch("http://localhost:%d/" % port, self.stop) - response = self.wait() + self.http_client.fetch("http://localhost:%d/" % port, self.stop) + response = self.wait() self.assertEqual(599, response.code) if sys.platform != 'cygwin':