From: Ray Z. <rz...@co...> - 2001-10-22 13:24:52
|
Chris, For the error handling in our apps we've decided to use a sub-class of the Error class (as in Error.pm from CPAN) and just do something like ... die new My::Error('message', $other, $error, $info) ... where the constructor for My::Error records the stack trace, etc, and then use an eval block and "if ($@)" to catch it elsewhere. In the "if ($@)" part we can handle different types of error objects differently if desired. We'd like to be able to handle our SPOPS errors in the same framework, but it isn't quite as clean as we'd like. Since an SPOPS error dies with a string, we have to somehow determine from that string whether it was SPOPS that died or something else (not sure how to do this), then, if it was SPOPS, go get the info from the SPOPS error variables. So, I was wondering, why do you use the "put the error info into some error variables and die with a string" approach rather than "put the error info into an object and die with that object" approach to error handling in SPOPS? Maybe there is an advantage I don't see. And the follow-on question, in case it turns out the latter is more desirable ... would you consider changing it? Thanks, -- Ray Zimmerman / e-mail: rz...@co... / 428-B Phillips Hall Sr Research / phone: (607) 255-9645 / Cornell University Associate / FAX: (815) 377-3932 / Ithaca, NY 14853 |