mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
feat(db): add mapping for lock wait timeout
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
parent
b7b2966ce2
commit
3fb0aa40cd
3 changed files with 13 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ use Doctrine\DBAL\Exception\DriverException;
|
|||
use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
|
||||
use Doctrine\DBAL\Exception\InvalidArgumentException;
|
||||
use Doctrine\DBAL\Exception\InvalidFieldNameException;
|
||||
use Doctrine\DBAL\Exception\LockWaitTimeoutException;
|
||||
use Doctrine\DBAL\Exception\NonUniqueFieldNameException;
|
||||
use Doctrine\DBAL\Exception\NotNullConstraintViolationException;
|
||||
use Doctrine\DBAL\Exception\RetryableException;
|
||||
|
|
@ -82,6 +83,9 @@ class DbalException extends Exception {
|
|||
/**
|
||||
* Other server errors
|
||||
*/
|
||||
if ($this->original instanceof LockWaitTimeoutException) {
|
||||
return parent::REASON_LOCK_WAIT_TIMEOUT;
|
||||
}
|
||||
if ($this->original instanceof DatabaseObjectExistsException) {
|
||||
return parent::REASON_DATABASE_OBJECT_EXISTS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,6 +120,13 @@ class Exception extends BaseException {
|
|||
*/
|
||||
public const REASON_UNIQUE_CONSTRAINT_VIOLATION = 14;
|
||||
|
||||
/**
|
||||
* The lock wait timeout was exceeded
|
||||
*
|
||||
* @since 30.0.0
|
||||
*/
|
||||
public const REASON_LOCK_WAIT_TIMEOUT = 15;
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
* @psalm-return Exception::REASON_*
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use Doctrine\DBAL\Exception\DriverException;
|
|||
use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
|
||||
use Doctrine\DBAL\Exception\InvalidArgumentException;
|
||||
use Doctrine\DBAL\Exception\InvalidFieldNameException;
|
||||
use Doctrine\DBAL\Exception\LockWaitTimeoutException;
|
||||
use Doctrine\DBAL\Exception\NonUniqueFieldNameException;
|
||||
use Doctrine\DBAL\Exception\NotNullConstraintViolationException;
|
||||
use Doctrine\DBAL\Exception\ServerException;
|
||||
|
|
@ -45,6 +46,7 @@ class DbalExceptionTest extends \Test\TestCase {
|
|||
|
||||
public function dataDriverException(): array {
|
||||
return [
|
||||
[LockWaitTimeoutException::class, DbalException::REASON_LOCK_WAIT_TIMEOUT],
|
||||
[ForeignKeyConstraintViolationException::class, DbalException::REASON_FOREIGN_KEY_VIOLATION],
|
||||
[NotNullConstraintViolationException::class, DbalException::REASON_NOT_NULL_CONSTRAINT_VIOLATION],
|
||||
[UniqueConstraintViolationException::class, DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION],
|
||||
|
|
|
|||
Loading…
Reference in a new issue