Skip to content

Commit 246281f

Browse files
authored
Throw exception in case we are not able to start a transaction (#487)
1 parent 71321fe commit 246281f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/QueryReflection/PdoMysqlQueryReflector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ protected function simulateQuery(string $queryString)
4949
$this->pdo->beginTransaction();
5050
} catch (PDOException $e) {
5151
// not all drivers may support transactions
52+
throw new \RuntimeException('Failed to start transaction', $e->getCode(), $e);
5253
}
5354

5455
try {
@@ -60,6 +61,7 @@ protected function simulateQuery(string $queryString)
6061
$this->pdo->rollBack();
6162
} catch (PDOException $e) {
6263
// not all drivers may support transactions
64+
throw new \RuntimeException('Failed to rollback transaction', $e->getCode(), $e);
6365
}
6466
}
6567

src/QueryReflection/PdoPgSqlQueryReflector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ protected function simulateQuery(string $queryString)
4545
$this->pdo->beginTransaction();
4646
} catch (PDOException $e) {
4747
// not all drivers may support transactions
48+
throw new \RuntimeException('Failed to start transaction', $e->getCode(), $e);
4849
}
4950

5051
try {
@@ -56,6 +57,7 @@ protected function simulateQuery(string $queryString)
5657
$this->pdo->rollBack();
5758
} catch (PDOException $e) {
5859
// not all drivers may support transactions
60+
throw new \RuntimeException('Failed to rollback transaction', $e->getCode(), $e);
5961
}
6062
}
6163

0 commit comments

Comments
 (0)