1

I was trying to validate a transaction with some conditions on contract level and was wondering if it was possible in any way to give user feedback in the frontend if a require() fails - aka if it returns false.

Example

In contract:

function validate(x){
    require(x < y) --> outcome = false
}


In frontend: (fictional code)

try
    contract.validate(1);
catch RequireFailed
    //provide user feedback that the require failed.

So my question, is there any way to catch if a require fails, and if so.. How to catch it :)

Thanks in advance!

1
  • Please see here You can use then((result) { } )).catch(err) {} Commented Feb 16, 2018 at 16:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.