##// END OF EJS Templates
http: better reporting of msgpack unpack errors.
marcink -
r1110:17efd44c default
parent child Browse files
Show More
@@ -83,6 +83,29 b' class RepoMaker(object):'
83 83 self.url, payload, EXCEPTIONS_MAP, self._session_factory())
84 84
85 85
86 class ServiceConnection(object):
87 def __init__(self, server_and_port, backend_endpoint, session_factory):
88 self.url = urlparse.urljoin(
89 'http://%s' % server_and_port, backend_endpoint)
90 self._session_factory = session_factory
91
92 def __getattr__(self, name):
93 def f(*args, **kwargs):
94 return self._call(name, *args, **kwargs)
95
96 return f
97
98 @exceptions.map_vcs_exceptions
99 def _call(self, name, *args, **kwargs):
100 payload = {
101 'id': str(uuid.uuid4()),
102 'method': name,
103 'params': {'args': args, 'kwargs': kwargs}
104 }
105 return _remote_call(
106 self.url, payload, EXCEPTIONS_MAP, self._session_factory())
107
108
86 109 class RemoteRepo(object):
87 110
88 111 def __init__(self, path, config, url, session, with_wire=None):
@@ -178,7 +201,12 b' def _remote_call(url, payload, exception'
178 201 except pycurl.error as e:
179 202 raise exceptions.HttpVCSCommunicationError(e)
180 203
204 try:
181 205 response = msgpack.unpackb(response.content)
206 except Exception:
207 log.exception('Failed to decode repsponse %r', response.content)
208 raise
209
182 210 error = response.get('error')
183 211 if error:
184 212 type_ = error.get('type', 'Exception')
General Comments 0
You need to be logged in to leave comments. Login now