Skip to content

Commit

Permalink
Use Exception::getCode() to find SQL error state
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsunet committed Jul 4, 2024
1 parent 485fff4 commit a7ab2cd
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
Expand Down Expand Up @@ -94,7 +93,7 @@ public function acquireLock(): SequenceNumber
]);
} catch (DBALException $exception) {
$this->connection->rollBack();
if ($exception instanceof LockWaitTimeoutException) {
if ($exception instanceof LockWaitTimeoutException || ($exception instanceof DBALDriverException && ($exception->getCode() === 3572 || $exception->getCode() === 7))) {
throw new \RuntimeException(sprintf('Failed to acquire checkpoint lock for subscriber "%s" because it is acquired already', $this->subscriberId), 1652279016);
}
throw new \RuntimeException($exception->getMessage(), 1544207778, $exception);
Expand Down

0 comments on commit a7ab2cd

Please sign in to comment.