Re: easier error reporting

From: Date: Tue, 09 Jan 2001 13:29:15 +0000
Subject: Re: easier error reporting
References: 1 2  Groups: php.pear 
Request: Send a blank email to php-pear+get-886@lists.php.net to get a copy of this message
Mikhail Zabaluev wrote: > > 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? Multiple inheritance is a pretty nasty can of worms, especially if you have a proper OO language. For once, PHP's primitive OO support can actually be an advantage, the only problem I can see arises with multiple inheritance in PHP is namespace overlaps. I don't think this functionality benefits enough from multiple inheritance to start lobbying for it though. ;-) - Stig

« previous php.pear (#886) next »