MediaWiki 1.42.0
Wikimedia\Rdbms\DBExpectedError Class Reference

Base class for the more common types of database errors. More...

Inherits Wikimedia\Rdbms\DBError, and MessageSpecifier.

Inherited by Wikimedia\Rdbms\DBConnectionError, Wikimedia\Rdbms\DBQueryError, Wikimedia\Rdbms\DBReadOnlyError, Wikimedia\Rdbms\DBReplicationWaitError, and Wikimedia\Rdbms\DBTransactionError.

Collaboration diagram for Wikimedia\Rdbms\DBExpectedError:

Public Member Functions

 __construct (?IDatabase $db, $error, array $params=[], \Throwable $prev=null)
 
 getKey ()
 Returns the message key.
 
 getParams ()
 Returns the message parameters.
 
- Public Member Functions inherited from Wikimedia\Rdbms\DBError
 __construct (?IDatabase $db, $error, \Throwable $prev=null)
 Construct a database error.
 

Protected Attributes

string[] $params
 Message parameters.
 

Additional Inherited Members

- Public Attributes inherited from Wikimedia\Rdbms\DBError
IDatabase null $db
 

Detailed Description

Base class for the more common types of database errors.

These are known to occur frequently, so we try to give friendly error messages for them.

Stability: newable
Since
1.23

Definition at line 32 of file DBExpectedError.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Rdbms\DBExpectedError::__construct ( ?IDatabase $db,
$error,
array $params = [],
\Throwable $prev = null )
Stability: stable
to call
Parameters
IDatabase | null$db
string$error
array$params
\\Throwable | null$prev

Definition at line 43 of file DBExpectedError.php.

References Wikimedia\Rdbms\DBError\$db, and Wikimedia\Rdbms\DBExpectedError\$params.

Member Function Documentation

◆ getKey()

Wikimedia\Rdbms\DBExpectedError::getKey ( )

Returns the message key.

If a list of multiple possible keys was supplied to the constructor, this method may return any of these keys. After the message has been fetched, this method will return the key that was actually used to fetch the message.

Returns
string

Implements MessageSpecifier.

Reimplemented in Wikimedia\Rdbms\DBQueryTimeoutError, and Wikimedia\Rdbms\DBTransactionSizeError.

Definition at line 50 of file DBExpectedError.php.

◆ getParams()

Wikimedia\Rdbms\DBExpectedError::getParams ( )

Returns the message parameters.

Returns
array

Implements MessageSpecifier.

Definition at line 54 of file DBExpectedError.php.

References Wikimedia\Rdbms\DBExpectedError\$params.

Member Data Documentation

◆ $params

string [] Wikimedia\Rdbms\DBExpectedError::$params
protected

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