MacFly
June 28, 2022, 3:28pm
1
How it’s possible to get (in web3.js for example) the RPC error execution revert message ?
I see on my console that the message is known and I would lik to get it and display it on the UI of my Dapps
1 Like
Hi @MacFly ,
Have you been able to review the RPC API section of the MetaMask docs here:
digging, but sharing what first comes to mind in case it helps.
1 Like
MacFly
July 1, 2022, 12:18pm
3
Thanks @KBeeTheCapybara but yes i read the RPC API documentation but unfortunatly i didn’t find an answer to my question.
To clarify : I would like to get the revert message (as written in solidity) and display it on the user interface. I can see in the console that the revert message is clearly visible so i think it’s could be possible to have a RPC API function able to get it ?
isn’t it ?
Thanks for your help
Gotcha, thanks for the clarification. I’m working on getting an answer for you.
I found this with something similar in comments…still not exact.
opened 11:20AM - 22 Jan 20 UTC
closed 11:26AM - 22 Jan 20 UTC
1.x
Hi
When we have a revert in a transaction, web3 throws an error, and the erro… r message contains this revert reason.
This error happen because i have a require inside my contract, so it is correct. So, i have a question: I can't get the custom message?
For example, if i have this require below:
` function functionExample( uint256 _number) public returns (bool) {
require(_number>10,"Number need to be bigger than 10");
}`
When i send a number, for example, 8 (<10, so require revert the transaction), and i`m receiving this return:
`{ Error: Transaction has been reverted by the EVM:
{
"blockHash": "0x4370ed0ddd1f121377ea336223050e760a70c7713a275639bc890e8857c3ba99",
"blockNumber": 5833233,
"contractAddress": null,
"cumulativeGasUsed": 391416,
"from": "0x3e31b2a2784fdf3b03b4401c53de19063f4a512e",
"gasUsed": 24055,
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": false,
"to": "0xb0345348c912d7856fb28cd6f7804c7dde339654",
"transactionHash": "0x9bbde7f847e442fe67f5c4bac60996435167da993d320176f0efd302130778ed",
"transactionIndex": 2
}`
Is it possible to receive the custom message? I mean, this message: "Number need to be bigger than 10".
This is so crucial for all contracts, and until now, i cant get this value...
Node: v10.15.3
Web3.js:
├─┬ truffle-contract@4.0.31
│ ├─┬ truffle-interface-adapter@0.2.5
│ │ └── web3@1.2.1
│ └── web3@1.2.1
├─┬ truffle-hdwallet-provider@1.0.17
│ └── web3@1.2.1
└── web3@1.2.5-rc.0
OS: MacOS
also this: solidity - How does one retrieve revert/require error messages from RPC - Ethereum Stack Exchange
4 Likes
MacFly
July 29, 2022, 8:32am
5
Hi @KBeeTheCapybara
Yes it’s the same issue but from what I read, the solution is not found. I would like to be able to display on the front end the message of the reverse reason
system
Closed
August 28, 2022, 3:14pm
7
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.