Re: Standardized way of interpolating variables into PEAR_Exceptionmessages?
| From: | Alexey Borzov | Date: | Mon, 25 Sep 2006 17:57:02 +0000 |
| Subject: | Re: Standardized way of interpolating variables into PEAR_Exceptionmessages? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-44058@lists.php.net to get a copy of this message | ||
Hi,
Dan Scott wrote:
Agreed. I have spent far more time trying to figure out the actual PEAR requirements for error-handling than I have on the core logic of my package proposals. A section in Coding Standards that describes the error-handling requirements and _most importantly_ best practices with copy and paste skeleton examples, differentiated for PHP 4 packages vs. PHP 5 packages, would be a god-send. I have plenty of Docbook-fu, so I would be willing to help mark up the text and add it to peardoc, if the Docbook markup is a barrier. But we do need one or two people to provide the text and code examples in the first place. A structure like the following might be a good start: Error-handling in PHP 4 packages * Issuing errors and warnings with PEAR_Error or PEAR_ErrorStack * Example * Handling errors and warnings thrown by other packages * Example * Defining error codes and messages (global constants and package message array) * ExampleI don't think this is the priority, since acceptance of PHP4 packages will effectively end soon...
Error-handling in PHP 5 packages * Issuing exceptions with PEAR_Exception * Example * Issuing warnings with ??? (not sure if there is any recommendation or requirement here) * Example * Handling exceptions thrown by other packagesAlso wrapping PEAR_Errors and PEAR_ErrorStack errors.
* Example * Defining error codes and messages (class constants and static message array)Also defining the exception class hierarchies.
* Example As I said, it's a start. I think the Coding Standards docs should focus on the core use cases with recommended best practices, and point to the PEAR_Error/ErrorStack/Exception package documentation for advanced possibilities. And as I said, I'm willing to help with the text-to-Docbook part of the job -- but I have to rely on the more seasoned PEAR developers to come up with the actual content.PEAR_Exception API docs are not in the manual, so these should be added as well. I'd suggest starting with the following * Add API docs for PEAR_Exception * Integrate the "Error Handling Guidelines for PHP5 packages" [1] into the manual, there is also a wiki [2] this RFC is built upon with plenty of info. You should also consider adding / changing things that were said in this thread. All this material is available, so you'll only have to do DocBook markup. [1] http://pear.php.net/pepr/pepr-proposal-show.php?id=132 [2] http://wiki.ciaweb.net/yawiki/index.php?area=PEAR_Dev&page=RfcExceptionUse