easier error reporting

From: Date: Mon, 08 Jan 2001 01:21:15 +0000
Subject: easier error reporting
Groups: php.pear 
Request: Send a blank email to php-pear+get-851@lists.php.net to get a copy of this message
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? - Stig

« previous php.pear (#851) next »