From bfcb93b2b9bc3bb1efd2e00c4169fb506e0eebab Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 21 Jan 2014 12:20:10 +0100 Subject: [PATCH] always be verbose when logging db error --- lib/db.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/db.php b/lib/db.php index 84b05dfe6e5..aee44e52596 100644 --- a/lib/db.php +++ b/lib/db.php @@ -382,7 +382,7 @@ class OC_DB { // Die if we have an error (error means: bad query, not 0 results!) if( self::isError($result)) { - throw new DatabaseException($result->getMessage(), $query); + throw new DatabaseException(self::getErrorMessage($result), $query); } }else{ try{ @@ -1117,10 +1117,8 @@ class OC_DB { */ public static function getErrorMessage($error) { if ( self::$backend==self::BACKEND_MDB2 and PEAR::isError($error) ) { - $msg = $error->getCode() . ': ' . $error->getMessage(); - if (defined('DEBUG') && DEBUG) { - $msg .= '(' . $error->getDebugInfo() . ')'; - } + $msg = $error->getCode() . ': ' . $error->getMessage() + . ' (' . $error->getDebugInfo() . ')'; } elseif (self::$backend==self::BACKEND_PDO and self::$PDO) { $msg = self::$PDO->errorCode() . ': '; $errorInfo = self::$PDO->errorInfo(); -- 2.39.5