Re: Catching errors in DB_DataObject
| From: | Justin Patrin | Date: | Fri, 19 Nov 2004 17:43:02 +0000 |
| Subject: | Re: Catching errors in DB_DataObject | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15690@lists.php.net to get a copy of this message | ||
On Fri, 19 Nov 2004 11:34:07 +0000, Phil Gyford <gyford@gmail.com> wrote:
> Hi,
>
> I'm new to PEAR, so if this or future questions are too dumb, or the
> answer's easily found elsewhere, do tell me!
>
> I'm using DB_DataObject successfully at the moment, but although I've
> read through much of the documentation and its handy examples, I'm not
> sure how best to catch things that go wrong. For example, if I do
> this:
>
$person = new DataObjects_Person();
if ($person->get( $id )) {
$person->myCustomFunction();
}
Check the return values on the get() function.
>
> I want to make sure $person has been created with a valid id before I
> go on to doing stuff with myCustomFunction(). I'm not clear how best
> to check things haven't failed. Do I (somehow) use PEAR::Error, which
> I'm having problems understanding...?
>
> Any help much appreciated.
>
> Thanks,
> Phil
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> !DSPAM:419ddc0a85815070912473!
>
>
--
Justin Patrin