Re: PEAR's Error Handling and PHP5
| From: | Patrick Müller | Date: | Wed, 21 Jun 2006 20:36:46 +0000 |
| Subject: | Re: PEAR's Error Handling and PHP5 | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-43072@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
Daniel Convissor wrote:What about: if ($mdb2->query($query) === false) { echo $mdb2->lastErrorMessage(); echo $mdb2->lastErrorCode(); } using boolean is much less annoying to me and imho much more simpler because novice users don't have to battle with an ugly error object. further it's always a question if the user really needs the information at runtime. if not one could use assertions, trigger_error or just logging to help with development. on the other hand you could put ovide context information? What about: if ($mdb2->query($query) === false) { echo $mdb2->lastErrorMessage(); echo $mdb2->lastErrorCode(); } using boolean is much less annoying to me and imho simpler. novice users don't have to battle with an ugly error object in the first place and it's much more common in php world.I haven't chimed in on this, yet. Exceptions are the way to go. In cases where exceptions are too harsh, return FALSE.And have no way to provide context information?
regards, Lukas