Re: Re: PEAR's Error Handling and PHP5

From: Date: Wed, 21 Jun 2006 04:09:10 +0000
Subject: Re: Re: PEAR's Error Handling and PHP5
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-43052@lists.php.net to get a copy of this message
On 6/20/06, Alan Knowles <alan@akbkhome.com> wrote:
I thought it overcomplicates the problem... I've been working with D alot in the last few weeks, part of which involved recreating DataObjects in D (well a mini cut down version). Using Exceptions helps alot, so int/bool returns make even more sense. Although I was looking for instances where Object based return errors could be used, I didnt find any. I suspect this is the case generally, For anything that did not justify a Exception, you would live with the code emiting warnings via trigger_error (non fatal messages), returning bools etc... And that would be sufficient in almost all cases... Otherwise, we remove the PEAR_Error code from PEAR.php, and allow it to be used on it's own Pear/Error.php ... and see if it get's used at all...
This reminds me of another reason I like Exceptions over PEAR_Error returns. It separates error handling from normal return values. There is no need to check return values as an error will throw an exception instead of returning an object which won't have the correct properties for code to continue. I would also like to point out the Exception discussion and guidelines on the wiki outline that as long as a function is expected to return a status that it need not throw an exception. In other words, if a failure is an expected outcome of a function call, it is not an error condition. (Of course, the caller would probably upgrade this to an error condition, but I digress.) See: http://wiki.ciaweb.net/yawiki/index.php?area=PEAR_Dev&page=RfcExceptionUse#toc27
Regards Alan Lukas Smith wrote: Lukas Smith wrote:
Hi, just for a fresh perspective I implemented 2 proxy classes that will re-throw as an exception or pear_error: http://pooteeweet.org/blog/430
hmm i must say i am a bit disappointed with the lack of feedback. i guess this means people do not think this is a viable approach? regards, Lukas
-- Justin Patrin

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