From: moijes12 Date: Sun, 4 May 2014 18:22:05 +0000 (+0530) Subject: Changed tornado/simple_httpclient.py to raise the error instead of X-Git-Tag: v4.0.0b1~81^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1042%2Fhead;p=thirdparty%2Ftornado.git Changed tornado/simple_httpclient.py to raise the error instead of storing the error message and then raising an HTTPError. Changed the websocket tests for network_fail and network timeout to expect an IOError instead of an HTTPError. --- diff --git a/tornado/simple_httpclient.py b/tornado/simple_httpclient.py index c7e6f1a94..d5b980611 100644 --- a/tornado/simple_httpclient.py +++ b/tornado/simple_httpclient.py @@ -371,7 +371,7 @@ class _HTTPConnection(object): if self.final_callback is not None: message = "Connection closed" if self.stream.error: - message = str(self.stream.error) + raise self.stream.error raise HTTPError(599, message) def _handle_1xx(self, code): diff --git a/tornado/test/websocket_test.py b/tornado/test/websocket_test.py index e45066536..648e5d8ca 100644 --- a/tornado/test/websocket_test.py +++ b/tornado/test/websocket_test.py @@ -114,25 +114,23 @@ class WebSocketTest(AsyncHTTPTestCase): def test_websocket_network_timeout(self): sock, port = bind_unused_port() sock.close() - with self.assertRaises(HTTPError) as cm: + with self.assertRaises(IOError) as cm: with ExpectLog(gen_log, ".*"): yield websocket_connect( 'ws://localhost:%d/' % port, io_loop=self.io_loop, connect_timeout=0.01) - self.assertEqual(cm.exception.code, 599) @gen_test def test_websocket_network_fail(self): sock, port = bind_unused_port() sock.close() - with self.assertRaises(HTTPError) as cm: + with self.assertRaises(IOError) as cm: with ExpectLog(gen_log, ".*"): yield websocket_connect( 'ws://localhost:%d/' % port, io_loop=self.io_loop, connect_timeout=3600) - self.assertEqual(cm.exception.code, 599) @gen_test def test_websocket_close_buffered_data(self):