PDOException.php 615 Bytes
Newer Older
1 2 3 4 5
<?php

namespace Doctrine\DBAL\Driver;

/**
6
 * @deprecated Use {@link Exception} instead
7 8
 *
 * @psalm-immutable
9
 */
10
class PDOException extends AbstractDriverException
11 12 13 14 15 16
{
    /**
     * @param \PDOException $exception The PDO exception to wrap.
     */
    public function __construct(\PDOException $exception)
    {
17 18 19 20 21 22
        if ($exception->errorInfo !== null) {
            [$sqlState, $code] = $exception->errorInfo;
        } else {
            $code     = $exception->getCode();
            $sqlState = null;
        }
23

24
        parent::__construct($exception->getMessage(), $sqlState, $code, $exception);
25 26
    }
}