From d07780b47824515266e3d6a9135f0c200d2ef458 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 30 Sep 2011 10:46:51 -0400 Subject: [PATCH] Output native PEAR DB errors to the log file --- lib/framework.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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');