mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 15:24:05 +02:00
Don't hide errors in the BackendAvailabilityNavigationItemRenderer
If an exception occurs when fetching the dataview, we will now log the exception and display a badge in state unknown.
This commit is contained in:
parent
439d78a982
commit
a9f3f99049
@ -4,6 +4,7 @@
|
||||
namespace Icinga\Module\Monitoring\Web\Navigation\Renderer;
|
||||
|
||||
use Exception;
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Module\Monitoring\Backend\MonitoringBackend;
|
||||
use Icinga\Web\Navigation\Renderer\BadgeNavigationItemRenderer;
|
||||
|
||||
@ -40,8 +41,15 @@ class BackendAvailabilityNavigationItemRenderer extends BadgeNavigationItemRende
|
||||
{
|
||||
if ($this->count === null) {
|
||||
try {
|
||||
$count = 0;
|
||||
$programStatus = $this->isCurrentlyRunning();
|
||||
} catch (Exception $e) {
|
||||
Logger::debug($e);
|
||||
$this->count = 1;
|
||||
$this->state = static::STATE_UNKNOWN;
|
||||
$this->title = $e->getMessage();
|
||||
return $this->count;
|
||||
}
|
||||
$count = 0;
|
||||
$titles = array();
|
||||
if (! (bool) $programStatus->notifications_enabled) {
|
||||
$count = 1;
|
||||
@ -58,19 +66,8 @@ class BackendAvailabilityNavigationItemRenderer extends BadgeNavigationItemRende
|
||||
}
|
||||
$this->count = $count;
|
||||
$this->title = implode('. ', $titles);
|
||||
} catch (Exception $_) {
|
||||
$this->count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getState()
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user