Skip to content

Commit e93dd6c

Browse files
committed
Keep Driver\DriverException
1 parent ab9c7e6 commit e93dd6c

File tree

12 files changed

+57
-70
lines changed

12 files changed

+57
-70
lines changed

UPGRADE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ The non-interface methods of driver-level classes have been marked internal:
8888

8989
The following classes under the `Driver` namespace have been deprecated in favor of their consistently named counterparts:
9090

91-
- `DriverException``LowLevelDriverException`
9291
- `AbstractDriverException``AbstractException`
9392
- `IBMDB2\DB2Driver``IBMDB2\Driver`
9493
- `IBMDB2\DB2Connection``IBMDB2\Connection`
@@ -110,7 +109,7 @@ All driver-specific exception classes have been deprecated:
110109
- `PDOException`
111110
- `SQLSrv\SQLSrvException`
112111

113-
A driver-level exception should be only identified as a subtype of `Doctrine\DBAL\Driver\LowLevelDriverException`
112+
A driver-level exception should be only identified as a subtype of `Doctrine\DBAL\Driver\DriverException`
114113
or when its wrapped as `Doctrine\DBAL\Exception\DriverException`.
115114
Internal driver-level exception implementations may use `Driver\AbstractException` as the base class.
116115
Driver-specific exception handling has to be implemented either in the driver or based on the type of the `Driver` implementation.

lib/Doctrine/DBAL/Cache/ResultCacheStatement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
use ArrayIterator;
66
use Doctrine\Common\Cache\Cache;
7+
use Doctrine\DBAL\Driver\DriverException;
78
use Doctrine\DBAL\Driver\FetchUtils;
8-
use Doctrine\DBAL\Driver\LowLevelDriverException;
99
use Doctrine\DBAL\Driver\Result;
1010
use Doctrine\DBAL\Driver\ResultStatement;
1111
use Doctrine\DBAL\Driver\Statement;
@@ -297,7 +297,7 @@ public function free(): void
297297
/**
298298
* @return array<string,mixed>|false
299299
*
300-
* @throws LowLevelDriverException
300+
* @throws DriverException
301301
*/
302302
private function doFetch()
303303
{

lib/Doctrine/DBAL/DBALException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Doctrine\DBAL;
44

5+
use Doctrine\DBAL\Driver\DriverException as LowLevelDriverException;
56
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
6-
use Doctrine\DBAL\Driver\LowLevelDriverException;
77
use Doctrine\DBAL\Exception\DriverException;
88
use Doctrine\DBAL\Platforms\AbstractPlatform;
99
use Doctrine\DBAL\Types\Type;

lib/Doctrine/DBAL/Driver/DriverException.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,31 @@
44

55
namespace Doctrine\DBAL\Driver;
66

7+
use Throwable;
8+
79
/**
8-
* @deprecated
9-
*
1010
* @psalm-immutable
1111
*/
12-
interface DriverException extends LowLevelDriverException
12+
interface DriverException extends Throwable
1313
{
14+
/**
15+
* Returns the driver specific error code if available.
16+
*
17+
* @deprecated Use {@link getCode()} or {@link getSQLState()} instead
18+
*
19+
* Returns null if no driver specific error code is available
20+
* for the error raised by the driver.
21+
*
22+
* @return int|string|null
23+
*/
24+
public function getErrorCode();
25+
26+
/**
27+
* Returns the SQLSTATE the driver was in at the time the error occurred.
28+
*
29+
* Returns null if the driver does not provide a SQLSTATE for the error occurred.
30+
*
31+
* @return string|null
32+
*/
33+
public function getSQLState();
1434
}

lib/Doctrine/DBAL/Driver/FetchUtils.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ final class FetchUtils
1212
/**
1313
* @return mixed|false
1414
*
15-
* @throws LowLevelDriverException
15+
* @throws DriverException
1616
*/
1717
public static function fetchOne(Result $result)
1818
{
@@ -28,7 +28,7 @@ public static function fetchOne(Result $result)
2828
/**
2929
* @return array<int,array<int,mixed>>
3030
*
31-
* @throws LowLevelDriverException
31+
* @throws DriverException
3232
*/
3333
public static function fetchAllNumeric(Result $result): array
3434
{
@@ -44,7 +44,7 @@ public static function fetchAllNumeric(Result $result): array
4444
/**
4545
* @return array<int,array<string,mixed>>
4646
*
47-
* @throws LowLevelDriverException
47+
* @throws DriverException
4848
*/
4949
public static function fetchAllAssociative(Result $result): array
5050
{
@@ -60,7 +60,7 @@ public static function fetchAllAssociative(Result $result): array
6060
/**
6161
* @return array<int,mixed>
6262
*
63-
* @throws LowLevelDriverException
63+
* @throws DriverException
6464
*/
6565
public static function fetchFirstColumn(Result $result): array
6666
{

lib/Doctrine/DBAL/Driver/LowLevelDriverException.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

lib/Doctrine/DBAL/Driver/Result.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface Result
1414
*
1515
* @return array<int,mixed>|false
1616
*
17-
* @throws LowLevelDriverException
17+
* @throws DriverException
1818
*/
1919
public function fetchNumeric();
2020

@@ -23,7 +23,7 @@ public function fetchNumeric();
2323
*
2424
* @return array<string,mixed>|false
2525
*
26-
* @throws LowLevelDriverException
26+
* @throws DriverException
2727
*/
2828
public function fetchAssociative();
2929

@@ -32,7 +32,7 @@ public function fetchAssociative();
3232
*
3333
* @return mixed|false
3434
*
35-
* @throws LowLevelDriverException
35+
* @throws DriverException
3636
*/
3737
public function fetchOne();
3838

@@ -41,7 +41,7 @@ public function fetchOne();
4141
*
4242
* @return array<int,array<int,mixed>>
4343
*
44-
* @throws LowLevelDriverException
44+
* @throws DriverException
4545
*/
4646
public function fetchAllNumeric(): array;
4747

@@ -50,7 +50,7 @@ public function fetchAllNumeric(): array;
5050
*
5151
* @return array<int,array<string,mixed>>
5252
*
53-
* @throws LowLevelDriverException
53+
* @throws DriverException
5454
*/
5555
public function fetchAllAssociative(): array;
5656

@@ -59,7 +59,7 @@ public function fetchAllAssociative(): array;
5959
*
6060
* @return array<int,mixed>
6161
*
62-
* @throws LowLevelDriverException
62+
* @throws DriverException
6363
*/
6464
public function fetchFirstColumn(): array;
6565

lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Doctrine\DBAL\Driver\SQLAnywhere;
44

5+
use Doctrine\DBAL\Driver\DriverException;
56
use Doctrine\DBAL\Driver\FetchUtils;
6-
use Doctrine\DBAL\Driver\LowLevelDriverException;
77
use Doctrine\DBAL\Driver\Result;
88
use Doctrine\DBAL\Driver\Statement;
99
use Doctrine\DBAL\Driver\StatementIterator;
@@ -352,7 +352,7 @@ public function fetchAssociative()
352352
/**
353353
* {@inheritdoc}
354354
*
355-
* @throws LowLevelDriverException
355+
* @throws DriverException
356356
*/
357357
public function fetchOne()
358358
{
@@ -362,7 +362,7 @@ public function fetchOne()
362362
/**
363363
* @return array<int,array<int,mixed>>
364364
*
365-
* @throws LowLevelDriverException
365+
* @throws DriverException
366366
*/
367367
public function fetchAllNumeric(): array
368368
{
@@ -372,7 +372,7 @@ public function fetchAllNumeric(): array
372372
/**
373373
* @return array<int,array<string,mixed>>
374374
*
375-
* @throws LowLevelDriverException
375+
* @throws DriverException
376376
*/
377377
public function fetchAllAssociative(): array
378378
{
@@ -382,7 +382,7 @@ public function fetchAllAssociative(): array
382382
/**
383383
* @return array<int,mixed>
384384
*
385-
* @throws LowLevelDriverException
385+
* @throws DriverException
386386
*/
387387
public function fetchFirstColumn(): array
388388
{

lib/Doctrine/DBAL/Exception/DriverException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Doctrine\DBAL\Exception;
44

55
use Doctrine\DBAL\DBALException;
6-
use Doctrine\DBAL\Driver\LowLevelDriverException;
6+
use Doctrine\DBAL\Driver\DriverException as LowLevelDriverException;
77
use Exception;
88

99
/**

lib/Doctrine/DBAL/Schema/OracleSchemaManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Doctrine\DBAL\Schema;
44

55
use Doctrine\DBAL\DBALException;
6-
use Doctrine\DBAL\Driver\LowLevelDriverException;
6+
use Doctrine\DBAL\Driver\DriverException;
77
use Doctrine\DBAL\Platforms\OraclePlatform;
88
use Doctrine\DBAL\Types\Type;
99
use Throwable;
@@ -37,7 +37,7 @@ public function dropDatabase($database)
3737
$exception = $exception->getPrevious();
3838
assert($exception instanceof Throwable);
3939

40-
if (! $exception instanceof LowLevelDriverException) {
40+
if (! $exception instanceof DriverException) {
4141
throw $exception;
4242
}
4343

0 commit comments

Comments
 (0)