Pylons/pyramid_rpc — Issue #19: JsonRpcError: data argument never used 
Author: aspineux
Created: 2011-12-25 04:30:40+00:00
State: open

this statement

raise JsonRpcParamsInvalid(data=dict(email='must contain a @'))

will return a value identical to this one

raise JsonRpcParamsInvalid()

because 'data' is not converted in JsonRpcError.as_dict()

I suggest to add these 2 lines to JsonRpcError.as_dict()

def as_dict(self):
"""Return a dictionary representation of this object for
serialization in a JSON-RPC response."""
error = dict(code=self.code,
message=self.message)
+ if self.data:
+ error['data']=self.data
return error

JSON-RPC 2.0 Specification proposal don't say nothing about the 'data' except it can be omitted and the value must be defined by the "Server"