in reply to How not to test exceptions

You might also want to reconsider your use of Error. Its known to introduce a whole new class of bugs that aren't present when using other exception handling methods.

See Re: Re2: Learning how to use the Error module by example for the scoop.

Replies are listed 'Best First'.
Re^2: How not to test exceptions
by jk2addict (Chaplain) on Jul 22, 2005 at 13:03 UTC

    That's good info. I wish it was mentioned in its pod. For now I'm ok I think based on the fact that I don't actually use try/catch in the code (maybe once), but I just use throw within the code when things go wrong. It sounds like the problems would more effect people using the dist catching MY exceptions in their code.

    Is there a decent replacement that can be shoehorned easily? Time to surf CPAN...

    Updated. Not that Error isn't evil based on others experience, but AxKit uses Error. It can't be all that bad. I've looked ad Exception, but the lack of the 'catch with' sugar annoys me so...Exceptions are try/catch after all.

      The problems Error has are introduced when you introduce the sugar which is why any Exception using code which avoids this error will also avoid the sugar. You can't get that sugar without also introducing that class of bugs. Its inherent.
        While that maybe true, who knows that? I didn't. Users just find Error on CPAN, install it and go about try/catching none the wiser. Maybe someone knowledgeable about the inherant problems with Errors try/catch should submit a pod path, or at least rate it accordinly.