Unverified Commit 1527d709 authored by Sergei Morozov's avatar Sergei Morozov Committed by GitHub

Merge pull request #4137 from morozov/deprecate-driver-exception-conversion-apis

Deprecate driver exception conversion APIs
parents 8e4b2b2f ad96ce28
# Upgrade to 2.11 # Upgrade to 2.11
## Deprecations in driver-level exception handling
1. The `ExceptionConverterDriver` interface and the usage of the `convertException()` method on the `Driver` objects are deprecated.
2. The `driverException()` and `driverExceptionDuringQuery()` factory methods of the `DBALException` class are deprecated.
3. Relying on the wrapper layer handling non-driver exceptions is deprecated.
## `DBALException` factory method deprecations ## `DBALException` factory method deprecations
1. `DBALException::invalidPlatformType()` is deprecated as unused as of v2.7.0. 1. `DBALException::invalidPlatformType()` is deprecated as unused as of v2.7.0.
...@@ -21,10 +27,6 @@ The driver and wrapper statement objects can be only created by the correspondin ...@@ -21,10 +27,6 @@ The driver and wrapper statement objects can be only created by the correspondin
The wrapper connection will automatically handle the lost connection if the driver supports reporting it. The wrapper connection will automatically handle the lost connection if the driver supports reporting it.
## The `ExceptionConverterDriver` interface is deprecated
All drivers will have to implement the exception conversion API.
## `DriverException::getErrorCode()` is deprecated ## `DriverException::getErrorCode()` is deprecated
The `DriverException::getErrorCode()` is deprecated as redundant and inconsistently supported by drivers. Use `::getCode()` or `::getSQLState()` instead. The `DriverException::getErrorCode()` is deprecated as redundant and inconsistently supported by drivers. Use `::getCode()` or `::getSQLState()` instead.
......
...@@ -139,6 +139,8 @@ class DBALException extends Exception ...@@ -139,6 +139,8 @@ class DBALException extends Exception
} }
/** /**
* @deprecated
*
* @param string $sql * @param string $sql
* @param mixed[] $params * @param mixed[] $params
* *
...@@ -157,6 +159,8 @@ class DBALException extends Exception ...@@ -157,6 +159,8 @@ class DBALException extends Exception
} }
/** /**
* @deprecated
*
* @return self * @return self
*/ */
public static function driverException(Driver $driver, Throwable $driverEx) public static function driverException(Driver $driver, Throwable $driverEx)
......
...@@ -39,6 +39,8 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver, ...@@ -39,6 +39,8 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @deprecated
*
* @link https://dev.mysql.com/doc/refman/8.0/en/client-error-reference.html * @link https://dev.mysql.com/doc/refman/8.0/en/client-error-reference.html
* @link https://dev.mysql.com/doc/refman/8.0/en/server-error-reference.html * @link https://dev.mysql.com/doc/refman/8.0/en/server-error-reference.html
*/ */
......
...@@ -26,6 +26,8 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver ...@@ -26,6 +26,8 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @deprecated
*/ */
public function convertException($message, DeprecatedDriverException $exception) public function convertException($message, DeprecatedDriverException $exception)
{ {
......
...@@ -38,6 +38,8 @@ abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDri ...@@ -38,6 +38,8 @@ abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDri
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @deprecated
*
* @link http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html * @link http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html
*/ */
public function convertException($message, DeprecatedDriverException $exception) public function convertException($message, DeprecatedDriverException $exception)
......
...@@ -37,6 +37,8 @@ abstract class AbstractSQLAnywhereDriver implements Driver, ExceptionConverterDr ...@@ -37,6 +37,8 @@ abstract class AbstractSQLAnywhereDriver implements Driver, ExceptionConverterDr
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @deprecated
*
* @link http://dcx.sybase.com/index.html#sa160/en/saerrors/sqlerror.html * @link http://dcx.sybase.com/index.html#sa160/en/saerrors/sqlerror.html
*/ */
public function convertException($message, DeprecatedDriverException $exception) public function convertException($message, DeprecatedDriverException $exception)
......
...@@ -30,6 +30,8 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver ...@@ -30,6 +30,8 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @deprecated
*
* @link http://www.sqlite.org/c3ref/c_abort.html * @link http://www.sqlite.org/c3ref/c_abort.html
*/ */
public function convertException($message, DeprecatedDriverException $exception) public function convertException($message, DeprecatedDriverException $exception)
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
namespace Doctrine\DBAL\Driver; namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\DriverException as TheDriverException; use Doctrine\DBAL\Driver\DriverException as TheDriverException;
use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Exception\DriverException;
/** /**
* Contract for a driver that is capable of converting DBAL driver exceptions into standardized DBAL driver exceptions. * Contract for a driver that is capable of converting DBAL driver exceptions into standardized DBAL driver exceptions.
* *
* @deprecated All implementors of the {@link Driver} interface will have to implement this API. * @deprecated
*/ */
interface ExceptionConverterDriver interface ExceptionConverterDriver
{ {
...@@ -19,6 +18,8 @@ interface ExceptionConverterDriver ...@@ -19,6 +18,8 @@ interface ExceptionConverterDriver
* It evaluates the vendor specific error code and SQLSTATE and transforms * It evaluates the vendor specific error code and SQLSTATE and transforms
* it into a unified {@link DriverException} subclass. * it into a unified {@link DriverException} subclass.
* *
* @deprecated
*
* @param string $message The DBAL exception message to use. * @param string $message The DBAL exception message to use.
* @param TheDriverException $exception The DBAL driver exception to convert. * @param TheDriverException $exception The DBAL driver exception to convert.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment