Re: Re: cvs: pear-core /PEAR ErrorStack5.php Warning.php
| From: | Alan Knowles | Date: | Mon, 06 Sep 2004 12:10:31 +0000 |
| Subject: | Re: Re: cvs: pear-core /PEAR ErrorStack5.php Warning.php | ||
| References: | 1 2 | Groups: | php.pear.dev php.pear.core |
| Request: | Send a blank email to pear-dev+get-33244@lists.php.net to get a copy of this message | ||
Greg Beaver wrote:
Hi,.... lots of stuff deleted..... I think what became clear after you had implemented it, was that you had attempted to catch warnings. - by coding around the fact that you couldnt use try/catch. What I was trying to illustrate was that you should _never_ expect to catch warnings, - Warnings should be prevented by a) sending the correct data to a method (eg. testing your input) b) calling some 'test' method prior to calling the method. (eg. a method to help you test your input) c) telling the method that you explicitly know it may have a non-critical failure, and instructing it not to warn you. I could not see any event that did not fit into those situations, that should not be an exception. (and exceptions can be carefully designed not to break the stack, by carefully placing try/catch and rethrowing.) Anything else, lower than that is debugging code, which needs a debug callback or logger, rather than a warning. I think previous examples of trigger_error as a crappy error handling mechanisim, was more to do with their use where exceptions now should be used. Regards Alan
Greg