Re: pear error handling
| From: | electroteque | Date: | Sun, 29 Dec 2002 11:29:54 +0000 |
| Subject: | Re: pear error handling | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-3104@lists.php.net to get a copy of this message | ||
to be less vague here is the output
DB Error: syntax error
SELECT gallery FROM galleries WHERE galleryID= [nativecode=1064 ** You have
an error in your SQL syntax. Check the manual that corresponds to your MySQL
server version for the right syntax to use near '' at line 1]
"Dan Rossi" <daniel@electroteque.org> wrote in message
news:EJECKPELDLGDPHHJOEDLOEPJDGAA.daniel@electroteque.org...
> i was following the error handling on the pear db page
>
> <?php
> error_reporting (E_ALL ^ E_NOTICE);// this function will handle all errors
> reported by PHP
> function php_error_handler ($errno, $errstr, $errfile, $errline) {
> die ("In $errfile, line: $errline\n<br>$errstr");
> }
> set_error_handler ('php_error_handler');// this function will catch errors
> generated by Pear,// transform it to PHP errors and trigger them to the
> php_error_handler
>
> function pear_error_handler ($err_obj) {
> $error_string = $err_obj->getMessage() . '<br>' .
> $error_obj->getDebugInfo();
> trigger_error ($error_string, E_USER_ERROR);
> }
> require 'DB.php';
> PEAR::setErrorHandling (PEAR_ERROR_CALLBACK, 'pear_error_handler');//
force
> an error
> $db = DB::connect('pgsql://postgres@localhost/no_db');...
> ?>
>
> -----Original Message-----
> From: Jesus M. Castagnetto [mailto:jcastagnetto@yahoo.com]
> Sent: Sunday, December 29, 2002 7:14 PM
> To: electroteque; pear-general@lists.php.net
> Subject: Re: [PEAR] pear error handling
>
>
> I think that you might be missing something there. The callback function
has
> to
> be of a form similar to the one used w/ set_error_handler() (see example
> there). The method you refer for the PEAR_Error object will not give you
> back
> anything you did not put there. See the code for getDebugInfo() in the
> PEAR_Error class, and you will notice it calls getUserInfo() which returns
> the
> $userinfo parameter you passed to the raiseError() method when generating
an
> error object.
>
> If I did not understood what you meant, some code or more details might
help
> us
> help you.
>
> --- electroteque <daniel@electroteque.org> wrote:
> > PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'handle_pear_error');
> >
> > $error_obj->getDebugInfo() , using this does not return the actual line
> > where the error is
> >
> >
> >
> > --
> > PEAR General Mailing List (http://pear.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> =====
> --- Jesus M. Castagnetto (jcastagnetto@yahoo.com)
>
> Research:
> http://metallo.scripps.edu/
> Personal: http://www.castagnetto.org/
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>