I am trying to return error messages from solidity. I have this contract:
pragma solidity ^0.4.23;
contract Simple {
function arithmetics(uint a, uint b){
require(a % 2 == 0, "Even value required.");
b = b * 3;
}
}
When I test in remix, it's returning me the following error message:
transact to Simple.arithmetics errored: VM error: revert. revert The transaction has been reverted to the initial state. Reason provided by the contract: "Even value required.". Debug the transaction to get more information.
However, when I tried calling it from my dApp using web3.js I am not getting an error message, only this:
Transaction ran out of gas.