ConnectionException.php
2 years ago
ConnectionLost.php
2 years ago
ConstraintViolationException.php
2 years ago
DatabaseDoesNotExist.php
2 years ago
DatabaseObjectExistsException.php
2 years ago
DatabaseObjectNotFoundException.php
2 years ago
DatabaseRequired.php
2 years ago
DeadlockException.php
2 years ago
DriverException.php
2 years ago
ForeignKeyConstraintViolationException.php
2 years ago
InvalidArgumentException.php
2 years ago
InvalidFieldNameException.php
2 years ago
InvalidLockMode.php
2 years ago
LockWaitTimeoutException.php
2 years ago
MalformedDsnException.php
2 years ago
NoKeyValue.php
2 years ago
NonUniqueFieldNameException.php
2 years ago
NotNullConstraintViolationException.php
2 years ago
ReadOnlyException.php
2 years ago
RetryableException.php
2 years ago
SchemaDoesNotExist.php
2 years ago
ServerException.php
2 years ago
SyntaxErrorException.php
2 years ago
TableExistsException.php
2 years ago
TableNotFoundException.php
2 years ago
TransactionRolledBack.php
9 months ago
UniqueConstraintViolationException.php
2 years ago
index.php
2 years ago
DriverException.php
32 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Doctrine\DBAL\Exception; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Doctrine\DBAL\Driver\Exception as TheDriverException; |
| 5 | use MailPoetVendor\Doctrine\DBAL\Exception; |
| 6 | use MailPoetVendor\Doctrine\DBAL\Query; |
| 7 | use function assert; |
| 8 | class DriverException extends Exception implements TheDriverException |
| 9 | { |
| 10 | private ?Query $query; |
| 11 | public function __construct(TheDriverException $driverException, ?Query $query) |
| 12 | { |
| 13 | if ($query !== null) { |
| 14 | $message = 'An exception occurred while executing a query: ' . $driverException->getMessage(); |
| 15 | } else { |
| 16 | $message = 'An exception occurred in the driver: ' . $driverException->getMessage(); |
| 17 | } |
| 18 | parent::__construct($message, $driverException->getCode(), $driverException); |
| 19 | $this->query = $query; |
| 20 | } |
| 21 | public function getSQLState() |
| 22 | { |
| 23 | $previous = $this->getPrevious(); |
| 24 | assert($previous instanceof TheDriverException); |
| 25 | return $previous->getSQLState(); |
| 26 | } |
| 27 | public function getQuery() : ?Query |
| 28 | { |
| 29 | return $this->query; |
| 30 | } |
| 31 | } |
| 32 |