in reply to Opinions of Error.pm

Greetings!

I am using Error.pm at the moment on a relatively big project without much of a hussle. From this experience, using Error.pm is probably better than doing your own exception code for the following reasons:

  1. nice (and predictable) layout of exceptions hyerarchy (by using your own exception base class you get the whole thing, and it croaks when you try to throw an Exception you don't have)
  2. makes the checking easier (if you miswrite your class name on your examplo above, you'll never treat that exception right, but you cannot catch with (or throw) an unknown exception
  3. makes the code easily maintainable and easier on the reading than barebones eval/if($@), and this is Good(tm)

My take on exception handling was this (just in case it may be useful to you), which is surely improveable, but I'm not going to touch it now ;-)

briefly: extensive logging and a nice exception hyerarchy with the alternate constructors from Error.pm which make everything easier to read.

Using try/catch with/catch/otherwise has worked nicely in some parts of the project and horribly in others (hosted Perl code which mangles with the C server that manages the Perl code, making dying really bad (lost place of dying, lost of cause and the stacktrace, etc...), so YMMV...

Good luck!

--
our $Perl6 is Fantastic;