Skip to content
PHP Ecosystem
Explore

Exception

API reference › yii › db › Exception

classyii\db\Exception
Extendsyii\base\Exception » Exception
Since2.0
Sourceframework/db/Exception.php
2 subclasses

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

PropertyTypeDescriptionDefined by
$errorInfoarrayThe error info provided by a PDO exception. Default: [].Exception
MethodDescriptionDefined by
__construct()Constructor.Exception
__toString()Exception
getName()Exception
public array $errorInfo = []

The error info provided by a PDO exception.

This is the same as returned by PDO::errorInfo.

public function __construct(string $message, array $errorInfo = [], string $code = '', Throwable|null $previous = null)

Constructor.

Parameters

ParameterTypeDescription
$messagestringPDO error message
$errorInfoarrayPDO error info
$codestringPDO error code
$previousThrowable|nullThe previous exception used for the exception chaining.
public function __toString(): string

Returns

string: Readable representation of exception

public function getName(): string

Returns

string: The user-friendly name of this exception