When an exception is thrown, the runtime mechanism first searches for an appropriate handler for it in the current scope. If such a handler does not exist, the current scope is exited and the function that is higher in the calling line is entered into scope.

This process is iterative; it continues until an appropriate handler has been found. An exception is considered to be handled upon its entry to a handler. At this point, all the local objects that were constructed on the path from a try block to a throw-expression have been destroyed. In other words, the stack has been unwound.