MediaWiki master
Wikimedia\Rdbms\DBError Class Reference

Database error base class. More...

Inherits RuntimeException.

Inherited by Wikimedia\Rdbms\DBExpectedError, and Wikimedia\Rdbms\DBUnexpectedError.

Collaboration diagram for Wikimedia\Rdbms\DBError:

Public Member Functions

 __construct (?IDatabase $db, $error, \Throwable $prev=null)
 Construct a database error.
 

Public Attributes

IDatabase null $db
 

Detailed Description

Database error base class.

Catching and silencing this class or its subclasses is strongly discouraged. Most code should not catch DB errors at all, but let them bubble to the MediaWiki exception handler. If necessary, cleanup can be done in a finally block; catching the exception and then rethrowing it is also acceptable.

Stability: newable

Definition at line 36 of file DBError.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Rdbms\DBError::__construct ( ?IDatabase  $db,
  $error,
\Throwable  $prev = null 
)

Construct a database error.

Stability: stable
to call
Parameters
IDatabase | null$dbObject which threw the error
string$errorA simple error message to be used for debugging
\\Throwable | null$prevPrevious throwable

Definition at line 47 of file DBError.php.

References Wikimedia\Rdbms\DBError\$db.

Member Data Documentation

◆ $db


The documentation for this class was generated from the following file: