web3.js
web3.js copied to clipboard
EIP-838 Error Codes
Expected behavior
It would be nice to be able to get the new, custom error codes with their arguments, introduced in Solidity 0.8.4. Ethers.js already supports them: https://github.com/shapeshift/ethers.js/blob/master/packages/tests/src.ts/test-contract-interface.ts#L636
Actual behavior
If I try to catch the error as in the link above, I get the following error message:
Error: Returned error: VM Exception while processing transaction: revert
Error code, error name, etc. are all undefined
Steps to reproduce the behavior
- Send a transaction to a contract that will revert with errors
- Try to catch the error
Environment
Web3.js v1.5.1 Node v12.18.4 elementary OS 5.1.7
This will be addressed in the 4.x rewrite.
@philknows Is there a timeline for that? :slightly_smiling_face:
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. If you believe this was a mistake, please comment.
Still important. OpenZeppelin Contracts is blocked from adopting custom errors until Web3.js supports them.
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. If you believe this was a mistake, please comment.
Not stale! Waiting patiently. 😁
@philknows Is there a timeline for that? slightly_smiling_face
Seems like they plan to release version 4.x in April: RELEASE.md#long-term-support-lts
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. If you believe this was a mistake, please comment.
gm. Dear bot remove the stale label. 😃
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. If you believe this was a mistake, please comment.
@TomiOhl is this issue still active
Yes, it very much is.Haven't tried the one on the 4.x branch yet, but it isn't addressed in the latest 1.x release afaik
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. If you believe this was a mistake, please comment.
Well, 4.x definitely wasn't released in April. Waiting
Hey @TomiOhl, we recently released 4.x Alpha last week. Still working diligently now on our Beta release for later this year.
Please @Muhammad-Altabba 🙏🙏🙏
Sorry I got busy with other tasks and was also sick for a couple of days :smiling_face_with_tear: . However, I will start working on it very soon :blush:... And nice to see you here @CruzMolina :bouquet:
Any progress on this? Just deployed a set of contracts in mumbai & polygon using 100% custom errors, and when a transaction fails I can only see "Fail". These opaque error messages makes the debugging process harder and slower. Any alternative or advice please?
Any progress on this? Just deployed a set of contracts in mumbai & polygon using 100% custom errors, and when a transaction fails I can only see "Fail". These opaque error messages makes the debugging process harder and slower. Any alternative or advice please?
- wait and eventually web3.js 4.0 will be released with support for these custom errors (rc 1 was released last week)
- or switch to something else:
- for any other use case than smart contract tests, use ethers.js
- if you're using web3.js because of truffle, switch to hardhat or foundry/forge
- if you're using truffle and don't want to switch, use this helper package: https://www.npmjs.com/package/custom-error-test-helper