Re: Call for Review: RFC for Error Handling in PHP5 packages
| From: | Sergio Carvalho | Date: | Fri, 06 Aug 2004 17:55:24 +0000 |
| Subject: | Re: Call for Review: RFC for Error Handling in PHP5 packages | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32493@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
One thing I dont see mentioned there is the ability to expect() errors. I dont know ErrorStack well enough yet, but IIRC it has a similar feature.Oops. This had already been discussed, and I made the compromise of adding an optional section on this topic, subject to posterior voting: http://aspn.activestate.com/ASPN/Mail/Message/zope-List/2115903 I'll add it to the wiki.
Finally for PHP4/PHP5 packages we may want to ponder a solution where packages optionally return Exceptions to package users. However internally they will use PEAR_Error. I havent really pondered this through but it seems to be fairly annoying to achieve. The best idea I have come up with is that there is a stack which determines what return format to use if exceptions have been enabled. Internal calls will add to the stack telling the class to return PEAR_Errors. Once the stack of internal calls is worked off the package knows to return an Exception as the user requested. The annoying part is that either you leave creating the Exception to raiseError(), thereby screwing with the trace in the exception or you have to duplicate alot of code. Then again we are talking about a cludge here anyways.On a first look, I don't get the advantage of using PEAR_Error internally and presenting Exceptions externally. Can you elaborate? Cheers, Sérgio
regards, Lukas
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc