From ada4d4e2b323c4b39050f927286983c6d31f16f0 Mon Sep 17 00:00:00 2001 From: Ziaratban Date: Wed, 4 Mar 2020 08:59:21 +0330 Subject: [PATCH] add Throwable in Connection::transaction() --- src/Connection.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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