Skip to content

Conversation

@fjl
Copy link
Contributor

@fjl fjl commented Jan 7, 2017

The message was used as both key and value in the error object.
This only affected unusual errors with no error code.

A common case where this occurred is connection errors:

go-ethereum >> ./build/bin/geth attach http://127.0.0.1:8545
# ... server shuts down ...
> eth.getBlock("latest")
Error: Invalid JSON RPC response: {"error":{"Post http://127.0.0.1:8545: dial tcp 127.0.0.1:8545: getsockopt: connection refused":"Post http://127.0.0.1:8545: dial tcp 127.0.0.1:8545: getsockopt: connection refused","code":-32603},"id":6,"version":"2.0"}
    at web3.js:3119:20
    at web3.js:6023:15
    at web3.js:4995:36
    at <anonymous>:1:1

The error is prettier with this PR applied:

> eth.getBlock("latest")
Error: Post http://127.0.0.1:8545: dial tcp 127.0.0.1:8545: getsockopt: connection refused
    at web3.js:3119:20
    at web3.js:6023:15
    at web3.js:4995:36
    at <anonymous>:1:1

Fixes #3528

The message was used as both key and value in the error object.
This only affected unusual errors with no error code.
@mention-bot
Copy link

@fjl, thanks for your PR! By analyzing the history of the files in this pull request, we identified @karalabe, @bas-vk and @cdetrio to be potential reviewers.

@fjl fjl added this to the 1.5.6 milestone Jan 8, 2017
@karalabe
Copy link
Member

karalabe commented Jan 9, 2017

LGTM but I'm not confident enough about how errors are returned on the RPC layer to an attached client. Could you take a look to make sure this doesn't accidentally break some error API @bas-vk ?

Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@karalabe karalabe merged commit 6cb39dd into ethereum:master Jan 9, 2017
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 this pull request may close these issues.

3 participants