try
-finally
(tweet)
#4817
ggreif
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The recent addition of
finally
-clauses totry
-blocks not only gives you a powerful tool to clean up (e.g. locks) in a disciplined and structured way. It will interpose all control-flow paths outward of thetry
-catch
and additionally also clean up if a canister traps after receiving a reply from extern. Previously this scenario could potentially brick your canister. Still, be very careful when reviewing code that does external messaging and may trap. Continue learning at https://internetcomputer.org/docs/current/motoko/main/writing-motoko/errors/#using-tryfinally.Beta Was this translation helpful? Give feedback.
All reactions