PEAR_Error and Error_Stack
| From: | Greg Beaver | Date: | Thu, 26 Feb 2004 01:17:57 +0000 |
| Subject: | PEAR_Error and Error_Stack | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-25873@lists.php.net to get a copy of this message | ||
Hi all,
I have been working on a solution to the problems with PEAR_Error for a while, and I think I'm finally getting close to a real, workable solution. I'd like some input - this is not a package proposal, but will become one if things seem all right.
http://www.chiaraquartet.net/Error_Stack
This is the url for the docs, source (it's a single file), and URL to the download.
pear install http://www.chiaraquartet.net/Error_Stack-0.4alpha.tgz
to install directly.
I did some profiling in PhpEd, and just the empty file with require_once 'Error/Stack.php'; is .6 ms faster. Error_Stack::staticPush() is 0.15 ms faster than PEAR::raiseError() (read: insignificant unless you have LOTS of errors :).
These speed improvements would mean nothing if it weren't for the tremendous feature improvements as well. Errors set up with Error_Stack contain the package in which the error originated, and have all the message generation features of Error_Raise, as well as the flexibility to pass in a default error message. In addition, the debug_backtrace() output is parsed to allow display of the actual context (file/line/class/function) where the error occurred - very useful if the same error can be raised in a number of different places in the source code.
Also, and most important, BC is possible with PEAR_Error, and forward compatibility with Exceptions in PHP 5 is built-in.
In any case, I'd like some feedback on whether all of you would like to see any improvements to the package, or whether there might be a better way to do things. Otherwise, I'll propose it.
Greg