Skip to content

Commit

Permalink
[qa] Add more helpful RPC timeout message
Browse files Browse the repository at this point in the history
Replace previous timeout('timed out',) exception with more detailed error.

Github-Pull: bitcoin#9077
Rebased-From: e89614b
  • Loading branch information
ryanofsky authored and MarcoFalke committed Nov 19, 2016
1 parent 1d4c884 commit da4926b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion qa/rpc-tests/test_framework/authproxy.py
Expand Up @@ -42,6 +42,7 @@
import decimal
import json
import logging
import socket
try:
import urllib.parse as urlparse
except ImportError:
Expand Down Expand Up @@ -157,7 +158,15 @@ def _batch(self, rpc_call_list):
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'})
Expand Down

0 comments on commit da4926b

Please sign in to comment.