Subject: | finally block is not executed if catch block throws an exception |
Date: | Tue, 13 Jul 2010 21:05:45 -0500 |
To: | bug-Try-Tiny [...] rt.cpan.org |
From: | Elliot Shank <perl [...] galumph.com> |
This could be considered a code bug or a documentation bug, depending upon one's perspective.
To quote from the 0.06 documentation: "Finally blocks are always executed making them suitable for cleanup code which cannot be handled using local." This is not true; if the catch block throws an exception, then the finally block does not get run.
I can see this from two perspectives. One could take the view that finally means finally dammit, and that that code should always execute, no matter what. On the other hand, one could say that catch blocks are supposed to be doing error handling and take care of such things as there being further problems. Given that view, it should just be documented that this is the case.