Jira issue originally created by user @doctrinebot:
This issue is created automatically through a Github pull request on behalf of deeky666:
This PR aims to have are more solid, abstracted and flexible driver exception conversion API as introduced in PR #364.
It removes the DBALExcpetion::ERROR_* constants in favour of returning the appropriate DBAL driver exception directly in the driver. Those constants are of no meaning anymore, as these exceptions get converted into dedicated exception instances anyways. This also allows custom driver implementations to handle their driver exception conversion manually and introducing custom driver exception classes. Moreover it saves one additional conversion step in DBALException.
A new DriverException interface has been introduced for driver exception to return the error code, SQLSTATE and message. This is an approach to have a uniform driver API just like Driver, Connection and Statement. This also offers some other opportunities.
Complementary the AbstractDriverException and PDOException classes have been introduced to provide the basic implementation and behaviour for driver exceptions.
PDOConnection and PDOStatement now wrap all method calls into try catch blocks, catch \PDOException and wrap it into DBAL's PDOException to provide DBAL's DriverException interface.
The API of the ExceptionConverterDriver has been changed to take the DBAL generated exception message and a DriverException instance to evaluate the driver specific error code and SQLSTATE in order to return the appropriate standardized DBAL driver exception instance.
The following DBAL driver exception class changes have been made:
There are a lot of changes that have been made but I think they are reasonable and important to have a better abstracted exception API. Also I would like to introduce a Configuration option for custom driver exception conversion which is only possible with this approach.
I hope you will like it, otherwise blame me to death! ;)
Comment created by @doctrinebot:
A related Github Pull-Request [GH-494] was closed:
Issue was closed with resolution "Fixed"