Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
621 lars 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace Doctrine\DBAL\Driver\PDO;
6
 
7
use Doctrine\DBAL\Driver\Exception as DriverException;
8
 
9
/**
10
 * @internal
11
 *
12
 * @psalm-immutable
13
 */
14
final class PDOException extends \PDOException implements DriverException
15
{
16
    private ?string $sqlState = null;
17
 
18
    public static function new(\PDOException $previous): self
19
    {
20
        $exception = new self($previous->message, 0, $previous);
21
 
22
        $exception->errorInfo = $previous->errorInfo;
23
        $exception->code      = $previous->code;
24
        $exception->sqlState  = $previous->errorInfo[0] ?? null;
25
 
26
        return $exception;
27
    }
28
 
29
    public function getSQLState(): ?string
30
    {
31
        return $this->sqlState;
32
    }
33
}