Skip to content

Commit

Permalink
added check for active transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
v-dem committed Feb 25, 2024
1 parent 8a8e11d commit 7e3d72f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,16 @@ public function trans($func)
if ($this->inTransaction()) {
$this->commit();
} else {
$this->logger->debug('Transaction was not started or already committed.');
$this->logger->debug('Commit check: Transaction was not started or already committed.');
}

return $result;
} catch (Exception $e) {
$this->rollBack();
if ($this->inTransaction()) {
$this->rollBack();
} else {
$this->logger->debug('Rollback check: Transaction was not started or already committed.');
}

throw $e;
}
Expand Down

0 comments on commit 7e3d72f

Please sign in to comment.