Re: PEAR's Error Handling and PHP5
| From: | Greg Beaver | Date: | Wed, 21 Jun 2006 21:07:29 +0000 |
| Subject: | Re: PEAR's Error Handling and PHP5 | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-43073@lists.php.net to get a copy of this message | ||
Patrick Müller wrote:
> Lukas Smith wrote:
>
>> Daniel Convissor wrote:
>>
>>> 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?
>
>
> 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.
This is how PEAR_ErrorStack works, except it is possible to return
multiple error messages, codes, and also error severities.
Greg