for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Doctrine\DBAL\Driver;
/**
* Tiny wrapper for PDOException instances to implement the {@link DriverException} interface.
*
* @author Steve Müller <[email protected]>
* @link www.doctrine-project.org
* @since 2.5
*/
class PDOException extends AbstractDriverException
{
* The driver specific error code.
* @var int|string|null
private $errorCode;
* The SQLSTATE of the driver.
* @var string|null
private $sqlState;
public static function fromPDOException(\PDOException $exception)
$e = new self(
$exception->getMessage(),
$exception->errorInfo[0] ?? $exception->getCode(),
$exception->errorInfo[1] ?? $exception->getCode()
);
$e->code = $exception->getCode();
}
* {@inheritdoc}
public function getErrorCode()
return $this->errorCode;
public function getSQLState()
return $this->sqlState;