Re: [PHP] Re: poll: howto do informative error handling without the fatalities

[email protected] (Teus Benschop)
Newsgroups php.general
Message-ID <1265697303.3345.0.camel@2530p>
On Tue, 2010-02-09 at 07:22 +0100, Rene Veerman wrote:
> I would also like to hear suggestions on how to fix this mess:
> 
> $r = funcA ( funcB ( funcC ( $p ) ) );
> 
> if funcB() / funcC() fails, how would you fudge/abort the calling
> function in the chain?
> One may think that funcA and funcB just check their parameters list
> for being "error" arrays, but the problem i foresee is that depending
> on the context of the $r= call, desired behaviour may vary at any
> stage in the funcA -> funcB -> funcC chain.
> 
I would abort it by embedding the mess in a try.. catch statement, then
throwing an exception. Teus.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.