mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 00:34: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();
|
return $this->getDbAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $callable
|
||||||
|
* @return $this
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
public function runFailSafeTransaction($callable)
|
public function runFailSafeTransaction($callable)
|
||||||
{
|
{
|
||||||
if (! is_callable($callable)) {
|
if (! is_callable($callable)) {
|
||||||
@ -43,7 +48,11 @@ class Db extends DbConnection
|
|||||||
$callable();
|
$callable();
|
||||||
$db->commit();
|
$db->commit();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$db->rollback();
|
try {
|
||||||
|
$db->rollback();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// Well... there is nothing we can do here.
|
||||||
|
}
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user