vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/DriverException.php line 11

Open in your IDE?
  1. <?php
  2. namespace Doctrine\DBAL\Exception;
  3. use Doctrine\DBAL\DBALException;
  4. use Exception;
  5. /**
  6.  * Base class for all errors detected in the driver.
  7.  */
  8. class DriverException extends DBALException
  9. {
  10.     /**
  11.      * The previous DBAL driver exception.
  12.      *
  13.      * @var \Doctrine\DBAL\Driver\DriverException
  14.      */
  15.     private $driverException;
  16.     /**
  17.      * @param string                                $message         The exception message.
  18.      * @param \Doctrine\DBAL\Driver\DriverException $driverException The DBAL driver exception to chain.
  19.      */
  20.     public function __construct($message, \Doctrine\DBAL\Driver\DriverException $driverException)
  21.     {
  22.         $exception null;
  23.         if ($driverException instanceof Exception) {
  24.             $exception $driverException;
  25.         }
  26.         parent::__construct($message0$exception);
  27.         $this->driverException $driverException;
  28.     }
  29.     /**
  30.      * Returns the driver specific error code if given.
  31.      *
  32.      * Returns null if no error code was given by the driver.
  33.      *
  34.      * @return int|string|null
  35.      */
  36.     public function getErrorCode()
  37.     {
  38.         return $this->driverException->getErrorCode();
  39.     }
  40.     /**
  41.      * Returns the SQLSTATE the driver was in at the time the error occurred, if given.
  42.      *
  43.      * Returns null if no SQLSTATE was given by the driver.
  44.      *
  45.      * @return string|null
  46.      */
  47.     public function getSQLState()
  48.     {
  49.         return $this->driverException->getSQLState();
  50.     }
  51. }