Re: cvs: pear-core /PEAR ErrorStack5.php Warning.php

From: Date: Mon, 06 Sep 2004 10:03:00 +0000
Subject: 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-33242@lists.php.net to get a copy of this message
Bertrand Mansion wrote:
Greg Beaver wrote:
Warnings can be much more than debugging code. They can be used for flagging suspect user input (debugging user's usage of your code). Complex packages can often be used in more than one way, and sometimes the choice means some input can be either completely valid but quirky, or invalid and really difficult to find the errors. Which it is often depends on what the user actually meant by their input. Using trigger_error() doesn't make any sense here, because you would be lumping developer-specific information (php errors/notices/warnings) with user-specific information (input debugging). Using an exception makes even less sense, as there is no logic error in the program itself - it can execute the user's wrong intentions with absolutely no conflict. This is just one example, if you really force me, I will continue to come up with them, but the fact is I am right and we can save some time if you will at least acknowledge that the problem exists so that we can move on to practical solutions. :)
What you describe as warnings looks more like error codes that should be returned from function calls. A warning is here to *warn* the user that he made something wrong. This is to happen as quickly as possible.
Its impossible to return a warning as an error code, since the function has succeeded. Example: $db = DB::connect($dsn); $db will contain a connection, even if a warning is fired. I also disagree that a warning is meant to tell the user that he made something wrong. A Warning is meant to signal a state the original developer identified as possibly wrong, with less than 100% certainty (100% certainly wrong are errors). If it is a light warning, or on the limit an informational warning, then I only want to be notified if the situation gets serious. Cheers, Sérgio

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.pear.dev (#33242) next »