]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Output native PEAR DB errors to the log file
authorEvan Prodromou <evan@status.net>
Fri, 30 Sep 2011 14:46:51 +0000 (10:46 -0400)
committerEvan Prodromou <evan@status.net>
Fri, 30 Sep 2011 14:46:51 +0000 (10:46 -0400)
lib/framework.php

index a11abdff4ef88e3a59b8a886bc62f9e2a2c00ae7..d68693868de28bd2e5ad84fc91826e510b77b09e 100644 (file)
@@ -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');