Don't hide errors in the MonitoringBadgeNavigationItemRenderer

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:
Eric Lippmann 2017-07-27 11:31:10 +02:00
parent 28790d254b
commit 439d78a982
1 changed files with 7 additions and 2 deletions

View File

@ -4,6 +4,7 @@
namespace Icinga\Module\Monitoring\Web\Navigation\Renderer; namespace Icinga\Module\Monitoring\Web\Navigation\Renderer;
use Exception; use Exception;
use Icinga\Application\Logger;
use Icinga\Authentication\Auth; use Icinga\Authentication\Auth;
use Icinga\Data\Filter\Filter; use Icinga\Data\Filter\Filter;
use Icinga\Data\Filterable; use Icinga\Data\Filterable;
@ -142,8 +143,12 @@ class MonitoringBadgeNavigationItemRenderer extends BadgeNavigationItemRenderer
if ($this->count === null) { if ($this->count === null) {
try { try {
$summary = $this->fetchDataView(); $summary = $this->fetchDataView();
} catch (Exception $_) { } catch (Exception $e) {
$this->count = 0; Logger::debug($e);
$this->count = 1;
$this->state = static::STATE_UNKNOWN;
$this->title = $e->getMessage();
return $this->count;
} }
$count = 0; $count = 0;
$titles = array(); $titles = array();