Skip to content

Commit 9cf10a4

Browse files
authored
Fix hook error handling (#241)
2 parents c2654c8 + 05a668f commit 9cf10a4

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

library/Notifications/Hook/ObjectsRendererHook.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Icinga\Module\Notifications\Hook;
66

7-
use Exception;
87
use Generator;
98
use Icinga\Application\Hook;
109
use Icinga\Application\Logger;
@@ -16,6 +15,7 @@
1615
use ipl\Html\ValidHtml;
1716
use ipl\Web\Url;
1817
use ipl\Web\Widget\Link;
18+
use Throwable;
1919

2020
/**
2121
* Base hook to prepare and render objects
@@ -178,7 +178,7 @@ function ($object) {
178178
}
179179
}
180180
}
181-
} catch (Exception $e) {
181+
} catch (Throwable $e) {
182182
Logger::error('Failed to load hook %s:', get_class($hook), $e);
183183
}
184184
}
@@ -289,7 +289,7 @@ final public static function renderObjectLink(Objects $object): ?ValidHtml
289289
]
290290
]);
291291
}
292-
} catch (Exception $e) {
292+
} catch (Throwable $e) {
293293
Logger::error('Failed to load hook %s:', get_class($hook), $e);
294294
}
295295
}

run.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

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

7-
$this->provideHook('Notifications/ObjectsRenderer');
7+
if ($this::exists('icingadb')) {
8+
$this->provideHook('Notifications/ObjectsRenderer');
9+
}
10+
811
$this->provideHook('authentication', 'SessionStorage', true);
912
$this->addRoute(
1013
'static-file',

0 commit comments

Comments
 (0)