|
1 | 1 | # Copyright 2017 Palantir Technologies, Inc.
|
2 | 2 | import logging
|
| 3 | +import traceback |
3 | 4 | from uuid import uuid4
|
4 | 5 |
|
5 | 6 | from concurrent.futures import ThreadPoolExecutor, Future
|
@@ -118,7 +119,7 @@ def _handle_request(self, request):
|
118 | 119<
10000
/code> | output = _make_response(request, error=e.error._data)
|
119 | 120 | except Exception as e: # pylint: disable=broad-except
|
120 | 121 | log.exception('synchronous method handler exception for request: %s', request)
|
121 |
| - output = _make_response(request, error=JSONRPCServerError()._data) |
| 122 | + output = _make_response(request, error={'code': JSONRPCServerError.CODE, 'message': traceback.format_exc()}) |
122 | 123 | else:
|
123 | 124 | if request._id in self._received_requests:
|
124 | 125 | log.error('Received request %s with duplicate id', request.data)
|
@@ -147,10 +148,11 @@ def did_finish_callback(completed_future):
|
147 | 148 | result = completed_future.result()
|
148 | 149 | except JSONRPCDispatchException as e:
|
149 | 150 | output = _make_response(request, error=e.error._data)
|
150 |
| - except Exception as e: # pylint: disable=broad-except |
151 |
| - # TODO(forozco): add more descriptive error |
| 151 | + except Exception: # pylint: disable=broad-except |
152 | 152 | log.exception('asynchronous method handler exception for request: %s', request)
|
153 |
| - output = _make_response(request, error=JSONRPCServerError()._data) |
| 153 | + output = _make_response(request, error={ |
| 154 | + 'code': JSONRPCServerError.CODE, 'message': traceback.format_exc() |
| 155 | + }) |
154 | 156 | else:
|
155 | 157 | output = _make_response(request, result=result)
|
156 | 158 | finally:
|
|
0 commit comments