Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Original error object is not available in thrown error #306

Open
bradjones1 opened this issue Mar 17, 2022 · 0 comments · May be fixed by #307
Open

Original error object is not available in thrown error #306

bradjones1 opened this issue Mar 17, 2022 · 0 comments · May be fixed by #307

Comments

@bradjones1
Copy link

Describe the bug

It is possible to catch a thrown JSONRPCError object on failure, but the original error from the request (e.g., over HTTP) is lost, after a number of re-creations of the error during processing. See instances of new JSONRPCError in the codebase.

To Reproduce
Steps to reproduce the behavior:

  1. Make a json-rpc request which returns an error.
  2. Observe the returned error object is of the shape:
{
  "code": 7979,
  "data": {
    "code": 7979,
    "data": "{\"jsonrpc\":\"2.0\",\"id\":null,\"error\":{\"code\":-32603,\"message\":\"Internal Error\",\"data\":\"Internal JSON-RPC error.\"}}"
  }
}

The original error is not useful as a string, and is effectively two layers deep.

Expected behavior

The error object should be informative of the error encountered, if it is coming from the server (instead of, say, a networking error.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant