Call for Review: RFC for Error Handling in PHP5 packages
| From: | Davey | Date: | Sat, 07 Aug 2004 03:36:18 +0000 |
| Subject: | Call for Review: RFC for Error Handling in PHP5 packages | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-32501@lists.php.net to get a copy of this message | ||
Hi,
I'd like to invite everyone interested to review the draft coding
guidelines on the usage of exceptions in PHP5 classes. After this last
review phase, I'll extract the Coding Guidelines section from the
document, and propose the RFC via PEPr. The page is here
http://wiki.ciaweb.net/yawiki/?area=PEAR_Dev&page=RfcExceptionUse#toc30
and is world editable. Feel free to add your insights to the Coding
Guidelines section.
I'll take the chance to say I'm sorry for the delay in taking this text
to the final stage. I've been putting out virtual fires for two weeks
now -- things are calming down, though.
<snip>
OK, I am still of the opinion that we can differentiate between how errors are handled internally, and how the user recieves them.
When I talk about a "user" I am not talking about Joe Smith who is visiting a website, I am talking about a developer using PEAR in their applications.
By using PEAR_ErrorStack (with which we can use PEAR_Error, PEAR_Exception or a home brew method, giving the developer that choice) we can provide the user with a SINGLE method of retrieving errors in their code.
Let me try to state why this is needed:
You have a package, Foo, which is a PHP 4 package, it works fine in PHP 5 and there is not PHP 5 only port.
You have a package, Bar which is a PHP 5 package.
You are working with both in a single script, Foo will be using PEAR_Error whilst Bar is using PEAR_Exception, meaning we need to capture two types of errors.
By using PEAR_ErrorStack, it doesn't matter that Foo is using PEAR_Error and Bar using PEAR_Exception, the user can handle BOTH in the same way.
I would urge that you consider this point - we MUST unify how errors are recieved by the USER, otherwise we're going to have tangles of error handling on the users end.
- Davey