From solidity 0.4.22, we can use a message with revert and require keywords to get an exact error message. ref
You can specify error reason strings for revert and require (support by tooling is still pending).
A sample contract illustrating this :
pragma solidity ^0.4.23;
contract TestExceptionHandling{
uint public a ;
constructor(uint _a) public{
a= _a;
}
function increaseA(uint b) public{
require(b > a, 'new value must be greater than a');
if (b > 50){
revert('Very large value');
}
a = b;
}
}
This code compiler without nay error. This is really awesome, thanks to devs for this.
But how can I capture this error in my DAPP using web3 or so?
support by tooling is still pendingpretty much answers your question. – goodvibration May 02 '18 at 12:09