From: Jörn Friedrich Dreyer Date: Tue, 21 Jan 2014 11:20:10 +0000 (+0100) Subject: always be verbose when logging db error X-Git-Tag: v5.0.15RC1~24^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bfcb93b2b9bc3bb1efd2e00c4169fb506e0eebab;p=nextcloud-server.git always be verbose when logging db error --- 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();