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


in reply to comprehensive error handling

Thank you everyone for your answers... they have been very helpful. I have already tried creating a method checkError and using the form:
open(...) or $self->checkError(-1, "message with $!");
I am using the method so that checkError has access to all of the methods for the class in its processing. This is a composite of a few of your suggestions and right now is addressing my current needs. For the long term, there is an attractiveness for using exceptions, though I am concerned by some of the comments I've read regarding limitations in the Perl exception mechanism.

Replies are listed 'Best First'.
Re^2: comprehensive error handling
by adrianh (Chancellor) on Jul 18, 2003 at 10:36 UTC
    For the long term, there is an attractiveness for using exceptions, though I am concerned by some of the comments I've read regarding limitations in the Perl exception mechanism

    The only problem I've come across is the lack of direct syntax support. Once you get over seeing eval, die and if ($@) instead of try, throw and catch there shouldn't be any problems.

    But then, as you've probably guessed, I have a bias towards exception handling as a "good thing" :-)