Re: PHP5: PEAR Error Handling
| From: | Greg Beaver | Date: | Wed, 25 Feb 2004 18:08:11 +0000 |
| Subject: | Re: PHP5: PEAR Error Handling | ||
| References: | 1 2 | Groups: | php.pear.core |
| Request: | Send a blank email to pear-core+get-122@lists.php.net to get a copy of this message | ||
Pierre-Alain Joye wrote:
On Wed, 25 Feb 2004 18:20:03 +0100 Tobias Schlitt <tobias@schlitt.info> wrote:PEAR_Error is avoided by most folks simply because it extends PEAR, and has serious performance issues due to this fact. In addition, error codes are essentially useless unless you know from whence an error comes, the debug_backtrace() included since PHP 4.3 is not always useful and is very performance-intensive as well. Also, there is absolutely no distinction of error severity, and putting error handling in the constructor of PEAR_Error means problems like the constantly recurring issues with pear download-all will always be with us. The error callback for the PEAR installer always dies, so if any error is raised at all, the entire process stops - this requires a special pushErrorHandling() call to fix, but the fact is we DO want to terminate on serious errors, and only continue on certain errors. There is also no support at all for logging errors, something that is always wanted on some level, whether it's to the screen or other methods. The most obvious issue is that PHP 5 will have an object-based error handling solution that will be inherently faster, and inherently better because it's internal to the language and will help with cross-PHP compatibility issues. It's definitely time to at least consider possibilities. PHP 5.1 is not the time to start, a robust, field-tested solution should be ready to deploy on the same day 5.1 is released. I'm not saying my work on Error_Stack is the solution, but it does offer some flexibility that should make migrating to any future solution a piece of cake. Plus, it ties together all of the existing solutions (the online version does not yet handle any trigger_error() errors, but adding this is trivial) and centralizes them so that there are neither backwards nor forwards compatibility issues at all. This is what we really need - something that can co-exist in both the older PEAR_Error world and the newer "now-we-know-how-to-really-do-it" error-handling world. GregHi all! I don't know, if this has been discussed befor here, but I guess this is one of the urgent things to happen. As everyone knows, PEAR_Error has some problems and PHP 5 brings exceptions. Both should be handled und 1 hat IMHO. Gerg built an advanced error handling which looks IMHO pretty usefull for this case.Which problems has PEAR_Error? Or do you mean some missing features? What's the relation between exceptions and errors? I'm surprised to hear your surpise over this :). I've been describing problems for a while now. If PEAR_Error is the best solution, then why does both PEAR_Dependency and the PEAR_Installer class use a hacked error stack? Remember the passing in of an array for error messages? This is not a good solution, as we've discovered, because for one thing it doesn't allow error codes, something PEAR_Error does allow.