Re: did i understood error handling guidelines correct?
| From: | cweiske | Date: | Fri, 13 Jul 2007 08:33:00 +0000 |
| Subject: | Re: did i understood error handling guidelines correct? | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-47454@lists.php.net to get a copy of this message | ||
Sebastian,
> > Your SQL Parser seems to throw exceptions which is correct.
> > (It should use an own exception class that extends PEAR_Exception)
> should or must? and why?
> what is expected from my own Exception different then PEAR_Exception?
> just the name?
If you have a package that utilizes multiple packages, e.g. in a method:
function doSomething() {
OtherPackage::curse();
EvenDifferentPackage::sleep();
}
then you can try/catch based on the exception type and distinguish in your own code if the exception
has been thrown in OtherPackge or in EvenDifferentPackage and react on it differently - e.g. because
an exception in OtherPackage may occur and is not bad (e.g. config could not be loaded), while an
Exception in EvenDifferentPackage is very, very bad and needs admin interaction.
With all methods throwing the same exception class, you cannot determine what type of error occured
(except you make rules for exception codes among *all* pear packages).
I just see that it's PEAR2 standards, not the current rules:
http://wiki.pear.php.net/index.php/PEAR2_Standards#Base_Exception_class
--
Christian