do NOT catch exceptions in hooks

maybe we need some parameter to hooks-calls, if all hooks should run, before exception get's re-thrown, as with this commit first exeception in a hook, will stop other hooks from running.
This commit is contained in:
Ralf Becker 2017-07-08 18:04:26 +02:00
parent 64740718aa
commit 8fe467157d

View File

@ -114,7 +114,7 @@ class Hooks
return false; return false;
} }
$ret = $redirects = array(); $ret = array();
foreach((array)self::$locations[$location][$appname] as $hook) foreach((array)self::$locations[$location][$appname] as $hook)
{ {
try { try {
@ -143,22 +143,17 @@ class Hooks
$ret[] = ExecMethod2($hook, $args); $ret[] = ExecMethod2($hook, $args);
} }
} }
catch (Exception\Redirect $e) catch (Api\Exception\AssertionFailed $e)
{ {
$redirects[] = $e; if (preg_match('/ file .+ not found!$/', $e->getMessage()))
}
catch (\Exception $e) {
_egw_log_exception($e);
}
}
if ($redirects)
{ {
if (count($redirects) > 1) // ignore not found hook
{ }
error_log("Multiple redirects for location '$location', only first one gets executed!"); else
{
throw $e;
}
} }
throw $redirects[0];
} }
// hooks only existing in filesystem used by setup // hooks only existing in filesystem used by setup