Skip to content

Commit

Permalink
Fix hook error handling (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg authored Jul 22, 2024
2 parents c2654c8 + 05a668f commit 9cf10a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions library/Notifications/Hook/ObjectsRendererHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Icinga\Module\Notifications\Hook;

use Exception;
use Generator;
use Icinga\Application\Hook;
use Icinga\Application\Logger;
Expand All @@ -16,6 +15,7 @@
use ipl\Html\ValidHtml;
use ipl\Web\Url;
use ipl\Web\Widget\Link;
use Throwable;

/**
* Base hook to prepare and render objects
Expand Down Expand Up @@ -178,7 +178,7 @@ function ($object) {
}
}
}
} catch (Exception $e) {
} catch (Throwable $e) {
Logger::error('Failed to load hook %s:', get_class($hook), $e);
}
}
Expand Down Expand Up @@ -289,7 +289,7 @@ final public static function renderObjectLink(Objects $object): ?ValidHtml
]
]);
}
} catch (Exception $e) {
} catch (Throwable $e) {
Logger::error('Failed to load hook %s:', get_class($hook), $e);
}
}
Expand Down
5 changes: 4 additions & 1 deletion run.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

/** @var \Icinga\Application\Modules\Module $this */

$this->provideHook('Notifications/ObjectsRenderer');
if ($this::exists('icingadb')) {
$this->provideHook('Notifications/ObjectsRenderer');
}

$this->provideHook('authentication', 'SessionStorage', true);
$this->addRoute(
'static-file',
Expand Down

0 comments on commit 9cf10a4

Please sign in to comment.