fluencelabs / aqua-book

5 stars 1 forks source link

how to throw exception in aqua? #8

Open dzmitry-lahoda opened 3 years ago

dzmitry-lahoda commented 3 years ago

something like aqua if x != y: throw "foobar"

dzmitry-lahoda commented 3 years ago

seems simplest form of thorwing is having 2 fields, one is set only on success, and other on fail. and access other side to get

    thrown: Object {
      "instruction": "call %init_peer_id% (\"callbackSrv\" \"log\") [list_updated.$.err_msg.[0]!] ",
      "msg": "variable with path '$.err_msg.[0]' not found in '{\"err_code\":[],\"err_msg\":[],\"ret_code\":201}' with an error: 'json value not set'",
      "peer_id": "12D3KooWMtzhued52HuCUE7P2uZVuYWDEviLSFa9xeYNKpUK2onV",
    }
dzmitry-lahoda commented 3 years ago

image

another way to throw - call throwing build in with err msg