Cleanup with Finally
A finally block attempts cleanup on both ordinary and exceptional exits from a protected operation, subject to how the program and runtime exit.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Trace a failed read
After a local handle opens, an attempt to parse content can fail. A finally action can close the handle while the failure continues outward. Exception propagation explains why the program may never reach normal code after that read.
Handle cleanup work itself
Closing or committing some resources can fail too. Specify which error is observable and preserve relevant context if another error was already in progress. See resource state for legal cleanup actions.[1]