How to get the RPC Error : Eexecution reverted message?

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


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.


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.

also this: solidity - How does one retrieve revert/require error messages from RPC - Ethereum Stack Exchange


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