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");
    }
1
  • so why use try? you can use has_auth.
    – Jimmy Guo
    Commented Jul 14, 2018 at 14:21

1 Answer 1

4

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

Your Answer

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

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