http://www.perlmonks.org?node_id=1031289


in reply to Re^3: Die inside Try::Tiny blocks
in thread Die inside Try::Tiny blocks

So finally blocks aren't in fact good ways to make sure cleanup gets performed? That's kind of advertised as their main purpose -- but DBIx, for example, reports most errors with exceptions (and I like that style in general).

Replies are listed 'Best First'.
Re^5: Die inside Try::Tiny blocks
by chromatic (Archbishop) on Apr 30, 2013 at 00:44 UTC
    So finally blocks aren't in fact good ways to make sure cleanup gets performed?

    They are, but you're talking about nesting code which may throw exceptions in the finally blocks of exception handlers. How are you going to handle those exceptions? Do they have their own finally blocks? This gets complicated pretty fast.

      Yes, complicated code is complicated. :-)

      It's frequently the case that cleanup operations can fail, is the thing, and that ignoring those errors leads to especially confusing bugs.