Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Die inside Try::Tiny blocks

by chromatic (Archbishop)
on Apr 27, 2013 at 21:50 UTC ( #1031016=note: print w/replies, xml ) Need Help??


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

You're probably doing something far more complicated than you ought to if your finally block can throw an exception. I wouldn't do anything more than logging an error or setting a flag to restart a computation.

Replies are listed 'Best First'.
Re^4: Die inside Try::Tiny blocks
by dd-b (Monk) on Apr 29, 2013 at 22:10 UTC
    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).
      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031016]
help
Chatterbox?
[Happy-the-monk]: Discipulus: are there any perl monks in Milano?
[Discipulus]: i the moment likely no
[karlgoethebier]: i wonder now it will be with my glasses.
[Discipulus]: Milan Perl Mongers seems frozen at 2009
[Discipulus]: karl you dont shoot with eyes, you shoot with the soul
[jkva]: Reminds me of Guardians of the Galaxy

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2017-10-20 10:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (260 votes). Check out past polls.

    Notices?