aqua-playground/aqua/examples/tryCatch.aqua
2021-06-12 12:03:46 +03:00

25 lines
569 B
Plaintext

import "@fluencelabs/aqua-lib/builtin.aqua"
service Unexisted("unex"):
getStr() -> string
data LastError:
instruction: string
msg: string
peer_id: string
service OpA("op"):
identity(s: string) -> string
func tryCatchTest(node_id: string) -> []string:
on node_id:
f: *string
try:
f <- Unexisted.getStr()
catch err:
c: *string
f <- OpA.identity(err.msg)
-- check if the call takes place on the node
i <- Peer.identify()
f <- OpA.identity(i.external_addresses!)
<- f