Skip to content

EspoCRM – Open Source CRM Application

Throw deadlock exception in transaction

Yurii5afdbc665f3c
diff --git a/application/Espo/ORM/TransactionManager.php b/application/Espo/ORM/TransactionManager.php
index 3efb4d3430..35b8b28d2b 100644
--- a/application/Espo/ORM/TransactionManager.php
+++ b/application/Espo/ORM/TransactionManager.php
@@ -102,8 +102,7 @@ class TransactionManager
$counter --;
if ($counter === 0) {
- /** @noinspection PhpUnhandledExceptionInspection */
- throw $e->getPrevious() ?? new RuntimeException();
+ throw $e;
}
return $this->runInternal($function, $counter);
diff --git a/tests/unit/Espo/ORM/TransactionManagerTest.php b/tests/unit/Espo/ORM/TransactionManagerTest.php
index 599b50bf50..10b77539eb 100644
--- a/tests/unit/Espo/ORM/TransactionManagerTest.php
+++ b/tests/unit/Espo/ORM/TransactionManagerTest.php
@@ -295,7 +295,7 @@ class TransactionManagerTest extends TestCase
throw new DeadlockException(previous: new PDOException());
});
- } catch (PDOException) {
+ } catch (DeadlockException) {
$thrown = true;
}