Web3.js: standard error codes

Created on 1 Dec 2016  路  5Comments  路  Source: ChainSafe/web3.js

It might be better suited for an EIP but I post it here as it belongs to the wider ethereum wallet ecosystem where some of the call to web3 api pass by middleware each having different behavior (that might not be specified at the node level).

Currently there is no standard for error code for any of the web3 methods. It means that dapps have no way to react differently to different type of errors.

The main one that many dapp must encounter is that currently every web3 provider that deal with user permission return an error when the tx is rejected by the user. This is because the web3 api does not have any mechanism to means rejection without making it an error.

On top of that since there is no error code standard, the dapp can only react in one way whether it was really the user canceling the transaction or if it was a legitimate error.

While for that particular case, a new improved api would be better, a standard error code would allow to solve it and provide better handling for all the other error types.

2.x Stale enhancement

Most helpful comment

馃憤

This is really needed! We're currently hacking together a solution by pattern matching against the error message, but if that message is localized we're doomed.

Standardized error codes across Trust and MetaMask and other web3 providers would be immense.

All 5 comments

This is very much needed, thank you for laying it out in an issue.

One problem is that errors can come from many layers of the stack, for example, as categories there are:

  • Networking issues connecting to node
  • Signing issues, regarding private key usage
  • Gas consumption errors, returned during estimation
  • Node errors, problems parsing or running tx
  • On-chain errors, like OOG or others.

It would be nice if these all used a similar error format, maybe had major error codes designated to the major categories.

+1, should coordinate with RPC error codes ethereum/EIPs#136

any update on this ?
What do we need to push this forward ?

what the status of https://github.com/ethereum/EIPs/issues/136 ?

馃憤

This is really needed! We're currently hacking together a solution by pattern matching against the error message, but if that message is localized we're doomed.

Standardized error codes across Trust and MetaMask and other web3 providers would be immense.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions

Was this page helpful?
0 / 5 - 0 ratings

Related issues

webersson picture webersson  路  3Comments

dhl picture dhl  路  3Comments

sundbry picture sundbry  路  3Comments

gabmontes picture gabmontes  路  3Comments

xpepermint picture xpepermint  路  3Comments