From 601eb2e804984fc358479787c8c8a38d73c664d9 Mon Sep 17 00:00:00 2001 From: tg666 Date: Thu, 15 Apr 2021 04:12:49 +0200 Subject: [PATCH] Fixed default behaviour (throwing) of exceptions that are caught in a transaction --- src/Transaction.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Transaction.php b/src/Transaction.php index f7afd66..2a8a0cb 100644 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -167,6 +167,10 @@ public function run() } catch (Throwable $e) { $result = NULL; $errorContext = $this->processError($e); + + if (!$errorContext->isDefaultBehaviourPrevented()) { + throw $errorContext->getError(); + } } finally { $this->processFinally($result, $errorContext ?? NULL); } @@ -243,10 +247,6 @@ private function processError(Throwable $e): ErrorContextInterface $errorContext = new ErrorContext($e); } - if (!$errorContext->isDefaultBehaviourPrevented()) { - throw $errorContext->getError(); - } - return $errorContext; }