diff --git a/src/Database/Adapter.php b/src/Database/Adapter.php index 4e9bcda44..3a916b011 100644 --- a/src/Database/Adapter.php +++ b/src/Database/Adapter.php @@ -388,19 +388,6 @@ public function withTransaction(callable $callback): mixed } catch (\Throwable $action) { try { $this->rollbackTransaction(); - - if ( - $action instanceof DuplicateException || - $action instanceof RestrictedException || - $action instanceof AuthorizationException || - $action instanceof RelationshipException || - $action instanceof ConflictException || - $action instanceof LimitException - ) { - $this->inTransaction = 0; - throw $action; - } - } catch (\Throwable $rollback) { if ($attempts < $retries) { \usleep($sleep * ($attempts + 1)); @@ -411,6 +398,18 @@ public function withTransaction(callable $callback): mixed throw $rollback; } + if ( + $action instanceof DuplicateException || + $action instanceof RestrictedException || + $action instanceof AuthorizationException || + $action instanceof RelationshipException || + $action instanceof ConflictException || + $action instanceof LimitException + ) { + $this->inTransaction = 0; + throw $action; + } + if ($attempts < $retries) { \usleep($sleep * ($attempts + 1)); continue;