diff --git a/src/Connection.php b/src/Connection.php index 324f85719..0bf1a0292 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -568,6 +568,10 @@ public function transaction(callable $actions, $transactionOptions = [], $sessio if($newClientSession->getTransaction()->getIsActive()) $newClientSession->getTransaction()->rollBack(); throw $e; + } catch (\Throwable $e) { + if($newClientSession->getTransaction()->getIsActive()) + $newClientSession->getTransaction()->rollBack(); + throw $e; } } -} +} \ No newline at end of file