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) {} – Girish Adiga Feb 16 '18 at 16:18

Your Answer

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

Browse other questions tagged or ask your own question.