aqua-playground/aqua/examples/tryCatch.aqua

25 lines
577 B
Plaintext
Raw 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
2021-12-30 12:40:55 +03:00
message: string
2021-06-10 17:55:30 +03:00
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-12-30 12:40:55 +03:00
f <- OpA.identity(err.message)
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