jffry has asked for the wisdom of the Perl Monks concerning the following question:

I'm using Exception::Class to define my exceptions classes, but I just stumbled into a design question. Should create lots of exception subclasses like this?
MyExceptions::SomeThingy MyExceptions::SomeThingy::SomeSpecificError MyExceptions::SomeThingy::AnotherProblem MyExceptions::SomeThingy::DontDoThat
But if the subclasses SomeSpecificError, AnotherProblem, DontDoThat aren't different, then why have them? I was thinking of replacing those subclasses with fields under SomeThingy. Like this:
MyException::SomeThingy' => { isa => 'MyException', description => 'Bad things happen here.', fields => [ 'descriptor', 'value' ], };
And then I throw them:
MyException::SomeThingy->throw( 'error' => 'You did something I didnt like.', 'descriptor' => 'DontDoThat', 'value' => $bad_variable, );
Hmmm. So I guess my question is, if all those subclasses do the same thing, am I getting anything out of creating them all? Other than the name of the exception itself tells me something about the error? If that is all I am gaining, then doesn't using fields make more sense? I'm new to OO, and new to using Perl as anything other than a glorified awk. Thanks.

UPDATE: This page covers what I was asking, too, in the paragraph titled "Write Sensible Throws Clauses".