Re: PEAR's Error Handling and PHP5

From: Date: Wed, 07 Jun 2006 16:58:16 +0000
Subject: Re: PEAR's Error Handling and PHP5
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-42833@lists.php.net to get a copy of this message
Using Exceptions for error control is no more a forced design choice than using PEAR_Error. Personally, I find the PEAR_Error mechanism to be cumbersome and impractical, yet I work with it in order to use PEAR. Exceptions are a clean, trusted mechanism for error handling which is supported in a number of languages, and they are a welcome addition in PHP 5. It would be a mistake not to employ them in PHP 5 PEAR packages. Those who choose not to use them can wrap the package code in a catch-all try-catch block and ignore the Exception, if they wish. Continuing with PEAR_Error is a poor plan that will promote ambiguity among error-handling interfaces. I believe PEAR should standardize on Exceptions for PHP 5 packages. -- Nick On Jun 7, 2006, at 12:35 PM, Pierre wrote:
On 6/7/06, Markus Wolff <wolff@21st.de> wrote:
Justin Patrin schrieb:
Some talking points: 1) Would it be possible for us to allow both PEAR_Error and
Exception
usage for PHP5 packages? Would this fragment our error handling too much? (This would, of course, require a version of PEAR_Error
which is
E_STRICT).
In places where PHP5-packages must interoperate with PHP4 ones, there won't be another solution here. No need for an E_STRICT-compatible PEAR_Error here, as in situations dealing with PHP4 packages E_STRICT will be impossible anyway. For PHP5-packages, I'm definitely pro-Exception.
I'm defitivally and totally against forcing design choices. Exceptions usage is a design choice Understand you use them when you consider you have not because a rule foces you to use them everywhere as error handler or control flow. --Pierre ps: I recommend to read Pragmatic Exceptions from Benjamin Booth (Dr. Dobbs journal serie) http://www.ddj.com/TechSearch/searchResults.jhtml?queryText=pragmatic+exceptions&x=0&y=0 --PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pear.dev (#42833) next »