mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 16:24:05 +02:00
Db: throw original exception when rollback fails
This commit is contained in:
parent
6d139752fe
commit
44425d4407
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user