2

Why can't we use a try block inside a eosio smart contract? This is the error I get when I try to catch the exeption from eosio::require_auth2() function...

error:
      cannot use 'try' with exceptions
      disabled
    try

This is the code snippet under discussion:

 try
    {
        require_auth2(st.issuer, N(issue));
    }
    catch (...)
    {
        eosio::print("EXCEPTION CAUGHT");
    }
  • so why use try? you can use has_auth. – Jimmy Guo Jul 14 '18 at 14:21
4

Webassembly, the language contracts are compiled to does not support try ... catch .... See https://github.com/WebAssembly/design/issues/1078

|improve this answer|||||

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.