Error handling can get fairly complicated. There may be cases where you want to allow an error to continue bubbling up the call stack to be handled at a higher level. In those cases, you may also need to perform some cleanup tasks. Often this can mean resetting some shared resource, but it could also simply be logging the current state of the application.
In this recipe, we'll see how to use finally to ensure that some code is executed, regardless of the error state.