Re: easier error reporting
| From: | (Mikhail Zabaluev) | Date: | Mon, 08 Jan 2001 13:20:31 +0000 |
| Subject: | Re: easier error reporting | ||
| References: | 1 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-869@lists.php.net to get a copy of this message | ||
Hello Stig,
On Mon, Jan 08, 2001 at 02:21 +0100, Stig S. Bakken wrote:
>
> Hi,
>
> The PEAR_Error class is nice and all, but it's not easy enough to use
> and I feel it is currently configurable in the wrong way (too much
> control deep down, too little control on top). DB lets you set the
> default behaviour for errors with origin within that object with the
> setErrorHandler() and raiseError() methods, maybe this functionality
> belongs in the base PEAR class? Example:
>
> $myObj->setErrorHandling(PEAR_ERROR_CALLBACK, array($errObj,
> "myErrorHandler"));
>
> ...then later in $myObj's code (instead of "return new
> PEAR_Error(...)"):
>
> $this->raiseError("blah");
>
> There should be a global default error handler too, so you don't have to
> configure it for every object. That'd have to be done with a function
> or static method:
>
> PEAR::setDefaultErrorHandling(PEAR_ERROR_PRINT);
>
> IMHO, something like this is necessary to make the PEAR error system
> more than just a good idea.
> My only concern is bloating the PEAR class. Any opinions?
My pro. It surely will help many classes.
Ahh, we wouldn't need to bloat PEAR if we had multiple inheritance
(probably a bad idea). Orr, if we could extend classes at runtime
by adding methods to them. Hello Zend wizards?
--
Stay tuned,
MhZ mailto:mookid@sigent.ru
-----------
If a camel is a horse designed by a committee, then a consensus forecast is a
camel's behind.
-- Edgar R. Fiedler