diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2016-11-02 15:08:54 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2016-11-07 12:04:19 -0500 |
commit | e89614b6abf28d7fe201c3db44a0df6e4db6de03 (patch) | |
tree | e4b06ca2e3700656c2a677a978857d9153bf18f7 /qa/rpc-tests/test_framework/authproxy.py | |
parent | 8463aaa63c5ac76421c4d2754ea9e17a31584c93 (diff) | |
download | bitcoin-e89614b6abf28d7fe201c3db44a0df6e4db6de03.tar.xz |
[qa] Add more helpful RPC timeout message
Replace previous timeout('timed out',) exception with more detailed error.
Diffstat (limited to 'qa/rpc-tests/test_framework/authproxy.py')
-rw-r--r-- | qa/rpc-tests/test_framework/authproxy.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/qa/rpc-tests/test_framework/authproxy.py b/qa/rpc-tests/test_framework/authproxy.py index fd7f32b5c6..dd183815da 100644 --- a/qa/rpc-tests/test_framework/authproxy.py +++ b/qa/rpc-tests/test_framework/authproxy.py @@ -42,6 +42,7 @@ import base64 import decimal import json import logging +import socket try: import urllib.parse as urlparse except ImportError: @@ -161,7 +162,15 @@ class AuthServiceProxy(object): return self._request('POST', self.__url.path, postdata.encode('utf-8')) def _get_response(self): - http_response = self.__conn.getresponse() + try: + http_response = self.__conn.getresponse() + except socket.timeout as e: + raise JSONRPCException({ + 'code': -344, + 'message': '%r RPC took longer than %f seconds. Consider ' + 'using larger timeout for calls that take ' + 'longer to return.' % (self._service_name, + self.__conn.timeout)}) if http_response is None: raise JSONRPCException({ 'code': -342, 'message': 'missing HTTP response from server'}) |