mbr / tinyrpc

A compact, modular transport and protocol agnostic RPC library. Does jsonrpc v2.
https://tinyrpc.readthedocs.org
MIT License
156 stars 53 forks source link

WIP: support jsonrpc errors with data with JSONRPCProtocol.parse_reply #64

Closed DrPyser closed 5 years ago

DrPyser commented 5 years ago

This is to follow up on #20 .

Started by adding failing test assertions that demonstrate the problem. Also revealed another error when calling serialize on an error obtained using parse_reply:

    def _to_dict(self):
        msg = {
            'jsonrpc': JSONRPCProtocol.JSON_RPC_VERSION,
            'id': self.unique_id,
            'error': {
                'message': str(self.error),
>               'code': self._jsonrpc_error_code
            }
        }
E       AttributeError: 'JSONRPCErrorResponse' object has no attribute '_jsonrpc_error_code'