mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-02-03 10:44:33 +00:00
[qa] Add more helpful RPC timeout message
Replace previous timeout('timed out',) exception with more detailed error.
This commit is contained in:
parent
8463aaa63c
commit
e89614b6ab
@ -42,6 +42,7 @@ import base64
|
|||||||
import decimal
|
import decimal
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import socket
|
||||||
try:
|
try:
|
||||||
import urllib.parse as urlparse
|
import urllib.parse as urlparse
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -161,7 +162,15 @@ class AuthServiceProxy(object):
|
|||||||
return self._request('POST', self.__url.path, postdata.encode('utf-8'))
|
return self._request('POST', self.__url.path, postdata.encode('utf-8'))
|
||||||
|
|
||||||
def _get_response(self):
|
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:
|
if http_response is None:
|
||||||
raise JSONRPCException({
|
raise JSONRPCException({
|
||||||
'code': -342, 'message': 'missing HTTP response from server'})
|
'code': -342, 'message': 'missing HTTP response from server'})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user