Re: Catching errors in DB_DataObject
| From: | Phil Gyford | Date: | Fri, 19 Nov 2004 17:55:15 +0000 |
| Subject: | Re: Catching errors in DB_DataObject | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15692@lists.php.net to get a copy of this message | ||
On Fri, 19 Nov 2004 09:43:02 -0800, Justin Patrin <papercrane@gmail.com> wrote:
> On Fri, 19 Nov 2004 11:34:07 +0000, Phil Gyford <gyford@gmail.com> wrote:
>>
> > 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.
Ah yes, I'd noticed that (sorry, should have said). And it'll do, many thanks.
I guess what I'm also getting at is that I've seen mentions of PEAR's
error-handling, and seen articles that mention how to use PEAR::Error
and suchlike while using DB directly (eg
http://www.onlamp.com/pub/a/php/2001/11/29/peardb.html
)... but
because the examples in the DB_DataObject documentation are
(understandably and necessarily) simple I'm not clear how/whether to
use PEAR::Error and PEAR_Error stuff in my code.
I'm feeling my way through this and I guess I'm in need of some more
real-world examples of code, rather than tutorial-type snippets... Any
suggestions welcome.
Thanks,
Phil