From: Evan Prodromou Date: Fri, 30 Sep 2011 14:46:51 +0000 (-0400) Subject: Output native PEAR DB errors to the log file X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d07780b47824515266e3d6a9135f0c200d2ef458;p=quix0rs-gnu-social.git Output native PEAR DB errors to the log file --- diff --git a/lib/framework.php b/lib/framework.php index a11abdff4e..d68693868d 100644 --- a/lib/framework.php +++ b/lib/framework.php @@ -151,10 +151,19 @@ function PEAR_ErrorToPEAR_Exception($err) if ($err->getCode() == DB_DATAOBJECT_ERROR_NODATA) { return; } + + $msg = $err->getMessage(); + $userInfo = $err->getUserInfo(); + + // Log this; push the message up as an exception + + common_log(LOG_ERR, "PEAR Error: $msg ($userInfo)"); + if ($err->getCode()) { - throw new PEAR_Exception($err->getMessage(), $err->getCode()); + throw new PEAR_Exception($msg, $err, $err->getCode()); + } else { + throw new PEAR_Exception($msg, $err); } - throw new PEAR_Exception($err->getMessage()); } PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'PEAR_ErrorToPEAR_Exception');