Skip to main content
1 of 2
matank001
  • 820
  • 5
  • 16

Well, you can try to use try-catch

Currently, Solidity supports different kinds of catch blocks depending on the type of error. If the error was caused by revert("reasonString") or require(false, "reasonString") (or an internal error that causes such an exception), then the catch clause of the type catch Error(string memory reason) will be executed.

Inside the catch block return the value you desire like in this example:

try initialize() returns (uint v) {
        return true;
    } catch Error(string memory /*reason*/) {
        // This is executed in case
        // revert was called inside initialize
        // and a reason string was provided.
        
        return false;
}
matank001
  • 820
  • 5
  • 16