Class yii\db\Exception

Inheritanceyii\db\Exception » yii\base\Exception » Exception
Subclassesyii\db\IntegrityException, yii\db\StaleObjectException, yii\elasticsearch\Exception
Available since version2.0
Source Code https://github.com/yiisoft/yii2/blob/master/framework/db/Exception.php

Exception represents an exception that is caused by some DB-related operations.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$errorInfo array The error info provided by a PDO exception. yii\db\Exception

Property Details

$errorInfo public property

The error info provided by a PDO exception. This is the same as returned by PDO::errorInfo.

public array $errorInfo = []

Method Details

__construct() public method

Constructor.

public void __construct ( $message, $errorInfo = [], $code 0, Exception $previous null )
$message string

PDO error message

$errorInfo array

PDO error info

$code integer

PDO error code

$previous Exception

The previous exception used for the exception chaining.

__toString() public method

public string __toString ( )
return string

Readable representation of exception

getName() public method

public string getName ( )
return string

The user-friendly name of this exception