/** * Constructor. * * @param \PDOException $exception The PDO exception to wrap. */ public function __construct(\PDOException $exception) { parent::__construct($exception->getMessage(), 0, $exception->getPrevious()); $this->code = $exception->getCode(); $this->errorInfo = $exception->errorInfo; $this->errorCode = isset($exception->errorInfo[1]) ? $exception->errorInfo[1] : $exception->getCode(); $this->sqlState = isset($exception->errorInfo[0]) ? $exception->errorInfo[0] : $exception->getCode(); }