thomaseizinger / rust-jsonrpc-client

A macro-driven JSON-RPC client for Rust.
https://docs.rs/jsonrpc_client
4 stars 6 forks source link

Add optional `data` field to `JsonRpcError` struct #31

Closed trevor-crypto closed 3 years ago

trevor-crypto commented 3 years ago

Any reason why this hasn't been included? Ran into this issue where the data field is sent back from the server but JsonRpcError does not include it so it gets lost.

From the spec: https://www.jsonrpc.org/specification#error_object

data A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).

From another rpc client: https://github.com/paritytech/jsonrpsee/blob/242cdb5201ee6d1d64f8249d68101df8e3a53c37/types/src/error.rs#L37

trevor-crypto commented 3 years ago

Also, I am willing to add this change if it is wanted.

thomaseizinger commented 3 years ago

Happy to include it. I never needed that which is why it is not there :)

I'd appreciate a proposal on how to include it in this lib!