Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Error.pm and try/catch/throw

Reply
Thread Tools

Error.pm and try/catch/throw

 
 
fishfry
Guest
Posts: n/a
 
      07-21-2005
Is Error.pm the standard way to do error handling these days? Or at
least *a* standard way?

Are there any standard or popular libraries of exceptions, or should I
just write my own Error.pm subclasses?
 
Reply With Quote
 
 
 
 
fishfry
Guest
Posts: n/a
 
      07-22-2005
In article
<(E-Mail Removed)>,
fishfry <(E-Mail Removed)> wrote:

> Is Error.pm the standard way to do error handling these days? Or at
> least *a* standard way?
>
> Are there any standard or popular libraries of exceptions, or should I
> just write my own Error.pm subclasses?


No responses? I was just curious to know what kind of error handling
people do. It seems to me that the try/catch/throw method is an
improvement to the old days of checking error returns and trying to pass
the right amount of error detail info upstairs to callers. I know how to
use eval and die handlers.

Do most serious Perl programmers use one method or another of handling
errors, and if so, what?
 
Reply With Quote
 
 
 
 
SMO
Guest
Posts: n/a
 
      07-22-2005
fishfry wrote:
> In article
> <(E-Mail Removed)>,
> fishfry <(E-Mail Removed)> wrote:
>
>
>>Is Error.pm the standard way to do error handling these days? Or at
>>least *a* standard way?
>>
>>Are there any standard or popular libraries of exceptions, or should I
>>just write my own Error.pm subclasses?

>
>
> No responses? I was just curious to know what kind of error handling
> people do. It seems to me that the try/catch/throw method is an
> improvement to the old days of checking error returns and trying to pass
> the right amount of error detail info upstairs to callers. I know how to
> use eval and die handlers.
>
> Do most serious Perl programmers use one method or another of handling
> errors, and if so, what?


FWIW I use try/catch/throw exception handling via a custom wrapping of
Error.pm

MS
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      07-22-2005
fishfry <(E-Mail Removed)> wrote:


> No responses?



Maybe potential responders have decided to keep their attitude to
themselves, as you have requested in the past?


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Richard Gration
Guest
Posts: n/a
 
      07-22-2005
On Thu, 21 Jul 2005 19:08:50 -0700, fishfry wrote:

> In article
> <(E-Mail Removed)>,
> fishfry <(E-Mail Removed)> wrote:
>
>> Is Error.pm the standard way to do error handling these days? Or at
>> least *a* standard way?
>>
>> Are there any standard or popular libraries of exceptions, or should I
>> just write my own Error.pm subclasses?

>
> No responses? I was just curious to know what kind of error handling
> people do. It seems to me that the try/catch/throw method is an
> improvement to the old days of checking error returns and trying to pass
> the right amount of error detail info upstairs to callers. I know how to
> use eval and die handlers.
>
> Do most serious Perl programmers use one method or another of handling
> errors, and if so, what?


I use eval and a custom error object. The main problem I have with this is
that the eval is at the top level and so any module error messages which
don't provide a line number in the caller (as is the case with
DBD::Sybase) can be difficult to trace. Otherwise it works well. I define
some error codes in my Error object and trapping specific errors can be as
simple as

die MyApp::Error->new(<errorcode>) unless (...);

Also unforseen errors get trapped by the eval. $@ is a string not an
object when that happens, but is easily remedied.

Rich

--
"...Then anyone who leaves behind him a written manual, and likewise
anyone who receives it, in the belief that such writing will be clear and
certain, must be exceedingly simple-minded..."
-- Plato, _Phaedrus_

 
Reply With Quote
 
fishfry
Guest
Posts: n/a
 
      07-22-2005
In article <(E-Mail Removed)>,
Tad McClellan <(E-Mail Removed)> wrote:

> fishfry <(E-Mail Removed)> wrote:
>
>
> > No responses?

>
>
> Maybe potential responders have decided to keep their attitude to
> themselves, as you have requested in the past?


Thanks Tad.
 
Reply With Quote
 
Ron Savage
Guest
Posts: n/a
 
      07-24-2005
On Thu, 21 Jul 2005 15:54:02 +1000, fishfry wrote:

Hi Fishy

If you search the archives of (I think) mod_perl's mailing list you'll seeError
has been repeatedly criticised. The alternative recommended isException::Class.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if and and vs if and,and titi VHDL 4 03-11-2007 05:23 AM



Advertisments