summaryrefslogtreecommitdiff
path: root/vendor/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php')
-rw-r--r--vendor/doctrine/dbal/src/Driver/API/OCI/ExceptionConverter.php52
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
3declare(strict_types=1);
4
5namespace Doctrine\DBAL\Driver\API\OCI;
6
7use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface;
8use Doctrine\DBAL\Driver\Exception;
9use Doctrine\DBAL\Exception\ConnectionException;
10use Doctrine\DBAL\Exception\DatabaseDoesNotExist;
11use Doctrine\DBAL\Exception\DatabaseObjectNotFoundException;
12use Doctrine\DBAL\Exception\DriverException;
13use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
14use Doctrine\DBAL\Exception\InvalidFieldNameException;
15use Doctrine\DBAL\Exception\NonUniqueFieldNameException;
16use Doctrine\DBAL\Exception\NotNullConstraintViolationException;
17use Doctrine\DBAL\Exception\SyntaxErrorException;
18use Doctrine\DBAL\Exception\TableExistsException;
19use Doctrine\DBAL\Exception\TableNotFoundException;
20use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
21use Doctrine\DBAL\Query;
22
23/** @internal */
24final 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}