2011-05-25 17:03:15 +00:00
|
|
|
<?php
|
2012-04-26 08:47:10 +00:00
|
|
|
/**
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
* @ingroup Database
|
|
|
|
|
*/
|
2017-02-24 16:17:16 +00:00
|
|
|
|
|
|
|
|
namespace Wikimedia\Rdbms;
|
|
|
|
|
|
2018-01-02 22:07:28 +00:00
|
|
|
use RuntimeException;
|
2011-05-25 17:03:15 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Database error base class
|
|
|
|
|
* @ingroup Database
|
|
|
|
|
*/
|
2018-01-02 22:07:28 +00:00
|
|
|
class DBError extends RuntimeException {
|
2016-09-14 09:28:18 +00:00
|
|
|
/** @var IDatabase|null */
|
2011-05-25 17:03:15 +00:00
|
|
|
public $db;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Construct a database error
|
2018-06-26 21:14:43 +00:00
|
|
|
* @param IDatabase|null $db Object which threw the error
|
2013-03-11 17:15:01 +00:00
|
|
|
* @param string $error A simple error message to be used for debugging
|
2018-03-23 09:57:21 +00:00
|
|
|
* @param \Exception|\Throwable|null $prev Previous exception
|
2011-05-25 17:03:15 +00:00
|
|
|
*/
|
2018-03-23 09:57:21 +00:00
|
|
|
public function __construct( IDatabase $db = null, $error, $prev = null ) {
|
|
|
|
|
parent::__construct( $error, 0, $prev );
|
2011-07-04 15:00:30 +00:00
|
|
|
$this->db = $db;
|
2011-05-25 17:03:15 +00:00
|
|
|
}
|
2013-10-13 12:09:36 +00:00
|
|
|
}
|
2017-02-24 16:17:16 +00:00
|
|
|
|
2018-05-29 16:21:31 +00:00
|
|
|
/**
|
|
|
|
|
* @deprecated since 1.29
|
|
|
|
|
*/
|
2017-02-24 16:17:16 +00:00
|
|
|
class_alias( DBError::class, 'DBError' );
|