[PEPr] Comment on PEAR::PEAR_ErrorLayer
| From: | Greg Beaver | Date: | Mon, 22 Nov 2004 02:25:00 +0000 |
| Subject: | [PEPr] Comment on PEAR::PEAR_ErrorLayer | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-34472@lists.php.net to get a copy of this message | ||
Greg Beaver (http://pear.php.net/user/cellog) has commented on the proposal for
PEAR::PEAR_ErrorLayer.
Comment:
Laurent is a man of my kind of thinking :). This is a problem, and
ErrorLayer is one approach to solving it. I think it is not the best
approach, but it is a good one (explication below)
btw, ErrorStack went beta in the last PEAR release.
Why? It does what it will do for PHP 4 quite well, and many of its
important features are superseded by exceptions in PHP 5.
ErrorLayer does not make handling errors any easier, nor does it actually
make raising errors any more flexible. If a package is designed to use
PEAR_Error internally, it can't magically switch to using anything else,
the same is true of any solution. Any change to error raising requires
rewrite and redesign. PEAR_ErrorStack is *only* useful in terms of
corraling diverse packages and diverse error raising solutions into a
single location.
You will not solve the dilemma of having to rewrite code for error
raising. Code must be rewritten to use a new error raising scenario,
because it inherently affects the design of the entire project (and it
should, that's also inherent in good design).
The only possibility of ease is to make *handling* errors easier, and
PEAR_ErrorStack is the closest thing to this in PHP4, because it can be
designed to collect errors from any source and log them with a single
location, something PEAR_Error is not designed to do, and only does with
great difficulty.
As for Sergio's Exceptions RFC, I think everyone agreed on the basics, now
it is time to put them into practice (remember, the RFC is alpha, so if a
better way rears its head, we need only change the RFC and vote on the
change)
I do think that it would be fine to re-visit error handling soon, but
let's wait until *at least* PHP 5.1 when a majority of coders in PEAR have
at least dipped their pen into php5-only. Otherwise informed decisions are
going to be replaced by flame wars again.
Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=176
--
Sent by PEPr, the automatic proposal system at http://pear.php.net