RE: [PEAR] Dobjects Error Thowing
| From: | LIMBOURG Arnaud | Date: | Tue, 17 Jun 2003 14:52:11 +0000 |
| Subject: | RE: [PEAR] Dobjects Error Thowing | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6047@lists.php.net to get a copy of this message | ||
oups sorry for the wrong code
$dbo->_lastError->getMessage();
The thing is that you are not supposed to access private memebers directly.
Alan should be able to give your more info on that.
Arnaud.
> Hi,
> Thanks for the suggestion Arnaud.
>
> Sadly after executing the $dbCapture->insert() attempting to:-
> echo $dbCapture->last_error->getMessage();
>
> Just gives me the error:-
> Fatal error: Call to a member function on a non-object in
> c:\htdocs\pma\htdocs\front\storedetails.php on line 37
>
> Doing a var_dump($dbCapture) does show that an error message
> is defined in
> the class:-
> ["_lastError"]=> object(pear_error)(7) { ["error_message_prefix"]=>
> string(0) "" ["mode"]=> int(1) ["level"]=> int(1024)
> ["code"]=> int(-18)
> ["message"]=> string(23) "DB Error: no such table"
> ["userinfo"]=> NULL
> ["callback"]=> NULL }
>
> What is the offical way to check a PEAR classes result is an
> error, and if
> so get the error message string back?
>
> Regards,
>
>
> Mike C.
>
> -----Original Message-----
> From: LIMBOURG Arnaud [mailto:arnaud.limbourg.prestataire@cegetel.fr]
> Sent: 17 June 2003 13:25
> To: Mike Carter; pear-general@lists.php.net
> Subject: RE: [PEAR] Dobjects Error Thowing
>
>
> > Hi,
> >
> > I'm just testing my failsafe code for when a
> > DataObject::insert() fails.
> > The method seems to just return key value/false. Yet the
> > documentation @
> >
> > http://devel.akbkhome.com/peardoc2/package.database.db-dataobj
> > ect.db-dataobj
> > ect.insert.html indicates that an error is thrown. How do I
> > catch the error
> > in PEAR/PHP ?
> >
> > $dbResult = $dbCapture->insert();
> > Var_dump(PEAR::isError($dbResult));
>
>
> if (!$dbResult) {
> die($dbCapture->last_error->getMessage());
> }
> At least that is what i understood from the code.
> Arnaud.
>
> ______________________________________________________________
> __________
> This e-mail has been scanned for all viruses by Star Internet. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ______________________________________________________________
> __________
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.489 / Virus Database: 288 - Release Date: 6/10/2003
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.489 / Virus Database: 288 - Release Date: 6/10/2003
>
>
> ______________________________________________________________
> __________
> This e-mail has been scanned for all viruses by Star Internet. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ______________________________________________________________
> __________
>