aqua-playground/aqua/examples/tryCatch.aqua
2021-12-30 12:40:55 +03:00

25 lines
577 B
Plaintext

import "@fluencelabs/aqua-lib/builtin.aqua"
service Unexisted("unex"):
getStr() -> string
data LastError:
instruction: string
message: 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.message)
-- check if the call takes place on the node
i <- Peer.identify()
f <- OpA.identity(i.external_addresses!)
<- f