This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Description
Is there an existing issue for this?
Current Behavior
When setting web.eth.handleRevert = true and calling any Smart Contract method that reverts with an error:
The following error is raised: "n.data.substring is not a function".
Expected Behavior
To return an error that contains the actual error from the Smart Contract.
Steps to Reproduce
The full details are at: #5677 (comment)
Web3.js Version
1.8.2
Environment
No response
Anything Else?
The current version of the Infura provider seems to be updated to put the error inside data.data. And here is what the internal object looks like with Infura:

And so we need to update web3.js to handle this. And here is the line that needs to be changed:
|
reasonData = err.data.substring(10); |
And it could be changed to something like:
reasonData = (err.data.data || err.data).substring(10);