Show More
@@ -419,6 +419,8 b' def createbytesresponseframesfromgen(str' | |||||
419 | payload=b'') |
|
419 | payload=b'') | |
420 |
|
420 | |||
421 | def createcommanderrorresponse(stream, requestid, message, args=None): |
|
421 | def createcommanderrorresponse(stream, requestid, message, args=None): | |
|
422 | # TODO should this be using a list of {'msg': ..., 'args': {}} so atom | |||
|
423 | # formatting works consistently? | |||
422 | m = { |
|
424 | m = { | |
423 | b'status': b'error', |
|
425 | b'status': b'error', | |
424 | b'error': { |
|
426 | b'error': { |
@@ -27,7 +27,7 b' def formatrichmessage(atoms):' | |||||
27 | msg = _(atom[b'msg']) |
|
27 | msg = _(atom[b'msg']) | |
28 |
|
28 | |||
29 | if b'args' in atom: |
|
29 | if b'args' in atom: | |
30 | msg = msg % atom[b'args'] |
|
30 | msg = msg % tuple(atom[b'args']) | |
31 |
|
31 | |||
32 | chunks.append(msg) |
|
32 | chunks.append(msg) | |
33 |
|
33 | |||
@@ -163,8 +163,10 b' class clienthandler(object):' | |||||
163 | if overall['status'] == 'ok': |
|
163 | if overall['status'] == 'ok': | |
164 | self._futures[frame.requestid].set_result(decoder(objs)) |
|
164 | self._futures[frame.requestid].set_result(decoder(objs)) | |
165 | else: |
|
165 | else: | |
166 | e = error.RepoError( |
|
166 | atoms = [{'msg': overall['error']['message']}] | |
167 |
|
|
167 | if 'args' in overall['error']: | |
|
168 | atoms[0]['args'] = overall['error']['args'] | |||
|
169 | e = error.RepoError(formatrichmessage(atoms)) | |||
168 | self._futures[frame.requestid].set_exception(e) |
|
170 | self._futures[frame.requestid].set_exception(e) | |
169 | else: |
|
171 | else: | |
170 | self._futures[frame.requestid].set_result(response) |
|
172 | self._futures[frame.requestid].set_result(response) |
General Comments 0
You need to be logged in to leave comments.
Login now