diff options
Diffstat (limited to 'vendor/doctrine/dbal/src/Driver/API/OCI')
| -rw-r--r-- | vendor/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/vendor/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php b/vendor/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php new file mode 100644 index 0000000..1c0dc79 --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\API\OCI; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface; | ||
| 8 | use Doctrine\DBAL\Driver\Exception; | ||
| 9 | use Doctrine\DBAL\Exception\ConnectionException; | ||
| 10 | use Doctrine\DBAL\Exception\DatabaseDoesNotExist; | ||
| 11 | use Doctrine\DBAL\Exception\DatabaseObjectNotFoundException; | ||
| 12 | use Doctrine\DBAL\Exception\DriverException; | ||
| 13 | use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; | ||
| 14 | use Doctrine\DBAL\Exception\InvalidFieldNameException; | ||
| 15 | use Doctrine\DBAL\Exception\NonUniqueFieldNameException; | ||
| 16 | use Doctrine\DBAL\Exception\NotNullConstraintViolationException; | ||
| 17 | use Doctrine\DBAL\Exception\SyntaxErrorException; | ||
| 18 | use Doctrine\DBAL\Exception\TableExistsException; | ||
| 19 | use Doctrine\DBAL\Exception\TableNotFoundException; | ||
| 20 | use Doctrine\DBAL\Exception\UniqueConstraintViolationException; | ||
| 21 | use Doctrine\DBAL\Query; | ||
| 22 | |||
| 23 | /** @internal */ | ||
| 24 | final class ExceptionConverter implements ExceptionConverterInterface | ||
| 25 | { | ||
| 26 | /** @link http://www.dba-oracle.com/t_error_code_list.htm */ | ||
| 27 | public function convert(Exception $exception, ?Query $query): DriverException | ||
| 28 | { | ||
| 29 | return match ($exception->getCode()) { | ||
| 30 | 1, | ||
| 31 | 2299, | ||
| 32 | 38911 => new UniqueConstraintViolationException($exception, $query), | ||
| 33 | 904 => new InvalidFieldNameException($exception, $query), | ||
| 34 | 918, | ||
| 35 | 960 => new NonUniqueFieldNameException($exception, $query), | ||
| 36 | 923 => new SyntaxErrorException($exception, $query), | ||
| 37 | 942 => new TableNotFoundException($exception, $query), | ||
| 38 | 955 => new TableExistsException($exception, $query), | ||
| 39 | 1017, | ||
| 40 | 12545 => new ConnectionException($exception, $query), | ||
| 41 | 1400 => new NotNullConstraintViolationException($exception, $query), | ||
| 42 | 1918 => new DatabaseDoesNotExist($exception, $query), | ||
| 43 | 2289, | ||
| 44 | 2443, | ||
| 45 | 4080 => new DatabaseObjectNotFoundException($exception, $query), | ||
| 46 | 2266, | ||
| 47 | 2291, | ||
| 48 | 2292 => new ForeignKeyConstraintViolationException($exception, $query), | ||
| 49 | default => new DriverException($exception, $query), | ||
| 50 | }; | ||
| 51 | } | ||
| 52 | } | ||
