From 44425d440700bcc2e8504c2b07ee5cf32b295ef8 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 4 Sep 2018 07:41:40 +0200 Subject: [PATCH] Db: throw original exception when rollback fails --- library/Director/Db.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/library/Director/Db.php b/library/Director/Db.php index bc28e39d..fab76b8a 100644 --- a/library/Director/Db.php +++ b/library/Director/Db.php @@ -31,6 +31,11 @@ class Db extends DbConnection return $this->getDbAdapter(); } + /** + * @param $callable + * @return $this + * @throws Exception + */ public function runFailSafeTransaction($callable) { if (! is_callable($callable)) { @@ -43,7 +48,11 @@ class Db extends DbConnection $callable(); $db->commit(); } catch (Exception $e) { - $db->rollback(); + try { + $db->rollback(); + } catch (Exception $e) { + // Well... there is nothing we can do here. + } throw $e; }