Re: [RFC] Errors and handling in PEAR
| From: | Arnaud Limbourg | Date: | Thu, 31 Jul 2003 20:16:24 +0000 |
| Subject: | Re: [RFC] Errors and handling in PEAR | ||
| References: | 1 | Groups: | php.pear.dev php.pear.qa |
| Request: | Send a blank email to pear-dev+get-19077@lists.php.net to get a copy of this message | ||
> 1. All packages that raise unique errors must define special error
> constants with a prefix of the package name followed by ERR_, as in
> PHPDOCUMENTOR_ERR_INVALID_TAG
Constants will become long, but readability can be improved with that.
> 2. Error constants will never be referred to by number, only by constant
> name. To resolve conflicts between packages, the returned error's
> getType() method must be used to determine which package an error came from.
Makes sense. I don't quite get the getType part.
> 3. All packages that raise unique errors must extend PEAR_Error with an
> error class named Package_Error, as in PhpDocumentor_Error, and must use
> this error class in returning all unique errors. If there is a
> difference between an error and exception, the Package_Exception class
> should be defined and used to throw a fatal exception. An example of
> this difference is a fatal documentation error in PhpDocumentor (error),
> and an invalid input to a function in PhpDocumentor (exception).
Well, some packages don't need to redefine PEAR_Error.
I'll have to read the last two points more carefully.
Arnaud.