Inheritance | yii\db\Exception » yii\base\Exception » Exception |
---|---|
Subclasses | yii\db\IntegrityException, yii\db\StaleObjectException |
Available since version | 2.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.
Property | Type | Description | Defined By |
---|---|---|---|
$errorInfo | array | The error info provided by a PDO exception. | yii\db\Exception |
Method | Description | Defined By |
---|---|---|
__construct() | Constructor. | yii\db\Exception |
__toString() | yii\db\Exception | |
getName() | yii\db\Exception |
The error info provided by a PDO exception. This is the same as returned by PDO::errorInfo.
Constructor.
public function __construct($message, $errorInfo = [], $code = '', $previous = null)
{
parent::__construct($message, 0, $previous);
$this->errorInfo = $errorInfo;
$this->code = $code;
}
public string __toString ( ) | ||
return | string |
Readable representation of exception |
---|
public function __toString()
{
return parent::__toString() . PHP_EOL
. 'Additional Information:' . PHP_EOL . print_r($this->errorInfo, true);
}