Merge "rdbms: Replace reportConnectionError() with direct throws"
[lhc/web/wiklou.git] / includes / libs / rdbms / database / Database.php
index 189eaf2..cb51113 100644 (file)
@@ -991,17 +991,13 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
        abstract protected function closeConnection();
 
        /**
-        * @param string $error Fallback error message, used if none is given by DB
+        * @deprecated since 1.32
+        * @param string $error Fallback message, if none is given by DB
         * @throws DBConnectionError
         */
        public function reportConnectionError( $error = 'Unknown error' ) {
-               $myError = $this->lastError();
-               if ( $myError ) {
-                       $error = $myError;
-               }
-
-               # New method
-               throw new DBConnectionError( $this, $error );
+               call_user_func( $this->deprecationLogger, 'Use of ' . __METHOD__ . ' is deprecated.' );
+               throw new DBConnectionError( $this, $this->lastError() ?: $error );
        }
 
        /**