aqua-playground/aqua/examples/tryCatch.aqua

25 lines
569 B
Plaintext
Raw Permalink Normal View History

2021-06-12 12:03:46 +03:00
import "@fluencelabs/aqua-lib/builtin.aqua"
2021-06-10 17:55:30 +03:00
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:
2021-06-12 12:03:46 +03:00
c: *string
2021-06-10 17:55:30 +03:00
f <- OpA.identity(err.msg)
2021-06-12 12:03:46 +03:00
-- check if the call takes place on the node
i <- Peer.identify()
f <- OpA.identity(i.external_addresses!)
2021-06-10 17:55:30 +03:00
<- f