Re: Re: cvs: pear-core /PEAR ErrorStack5.php Warning.php
| From: | Bertrand Mansion | Date: | Sat, 04 Sep 2004 07:12:34 +0000 |
| Subject: | Re: Re: cvs: pear-core /PEAR ErrorStack5.php Warning.php | ||
| References: | 1 | Groups: | php.pear.dev php.pear.core |
| Request: | Send a blank email to pear-dev+get-33214@lists.php.net to get a copy of this message | ||
Alan Knowles wrote:
>I wish I had more time to look at it.
>
>The more I look at it, I get the feeling that if you need to pass
>information back to the caller, then perhaps it should have been using
>an exception.
>
>The idea of turning the Warning handler on/off to catch messages slaps
>of why arnt exceptions being used..
>
>I suspect Warnings Should really be preventable by method arguments..
>(either a extra arg 'dont warn me' / returning booleans - and logging
>only done to detect programming errors, rather than actually be dealt with.
>
>It reminds me a bit of a debugger in some respects..
>
>I guess the big question is where does this fit in the equation of
>
>trigger_error("Some warning" E_USER_NOTICE); - an warning that should be
>preventable by checking args.. or telling the method that you know it
>might fail?
>
>throw PEAR_Exception() - a situation that is preventable by try()'ing.
I tend to agree with Alan here.
IMO, warnings are something that help you debug your code so no matter so it is important that you
see them immediately when you are developing and can log them when in production. And this is
something already supported by PHP natively (in the ini file).
I think we should really concentrate on PEAR_Exception and use trigger_error() for warnings. This
would make everything lighter and easier to understand for the end-user than requiring him to deal
with a new API.
Bertrand Mansion
Mamasam