Re: Automatic error reporting

From: Date: Mon, 18 Feb 2002 21:23:57 +0000
Subject: Re: Automatic error reporting
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-873@lists.php.net to get a copy of this message
function pear_error($obj) { die($obj->getMessage() . '<br>' . $obj->getDebugInfo()); } PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'pear_error'); http://vulcanonet.com/soft/pear_tut/ Tomas V.V.Cox Peter Bowyer wrote: > > After spending 3 hours debugging a single page and finding that the problem > was that PEAR DB wasn't returning the database native error message (in > fact there was no error message at all), I have to ask: is there any way to > get it to do this automatically without putting > if (!$db->something) { // Or using DB::isError() > // Tell pear to show error msg > } > after every database call - I want PEAR to give me the error message > without me always having to test for it, as this makes my code harder to > read, and anyhow, I'm lazy and don't like typing all that extra stuff :-) > > I'm using the latest version of PEAR-DB from php4/pear fyi. > > Thanks, > Peter. > > --oOo-- > Narrow Gauge on the web - photos, directory and forums! > http://www.narrow-gauge.co.uk > --oOo-- > Glenbranter - Scottish narrow gauge in 009 > http://glenbranter.narrow-gauge.co.uk > --oOo--

« previous php.pear.general (#873) next »