Commit f1658279 authored by Steve Müller's avatar Steve Müller

fix driver exception conversion for newer SQLite versions

parent 910be8c9
......@@ -40,18 +40,19 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver
*/
public function convertException($message, DriverException $exception)
{
if (strpos($exception->getMessage(), 'must be unique') !== false) {
if (strpos($exception->getMessage(), 'must be unique') !== false ||
strpos($exception->getMessage(), 'is not unique') !== false ||
strpos($exception->getMessage(), 'UNIQUE constraint failed') !== false
) {
return new Exception\UniqueConstraintViolationException($message, $exception);
}
if (strpos($exception->getMessage(), 'may not be NULL') !== false) {
if (strpos($exception->getMessage(), 'may not be NULL') !== false ||
strpos($exception->getMessage(), 'NOT NULL constraint failed') !== false
) {
return new Exception\NotNullConstraintViolationException($message, $exception);
}
if (strpos($exception->getMessage(), 'is not unique') !== false) {
return new Exception\UniqueConstraintViolationException($message, $exception);
}
if (strpos($exception->getMessage(), 'no such table:') !== false) {
return new Exception\TableNotFoundException($message, $exception);
}
......
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