1

When a solidity smart contract reverts with a message due to a failure on a require statement, the browser calling the smart contract returns "Error: VM Exception while processing transaction: revert". However, it does not show the message associated with the require statement.

I am using Truffle v5.0.1 (Solidity v0.5.0 and Node v11.6.0).

Is there a way to get this message in the browser?

0

Revert reason strings are a new-ish addition, and a big part of the ecosystem still has no support for it. Currently, the only way to get the reason string is by using the latest versions of ganache-cli with the latest versions of Truffle.

I don't know if Metamask has support to display it in the browser [citation needed], but you should be able to catch it in your code and do a console.log().

  • 1
    I updated ganache-cli also, and it now works :) Thanks – user1365247 Jan 8 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.