Skip to content

Commit 65b0773

Browse files
committed
Merge branch 'feature/config-error'
2 parents 759851a + 5438bab commit 65b0773

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

library/Graphite/Web/Widget/Graphs.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use Icinga\Application\Config;
66
use Icinga\Application\Icinga;
7+
use Icinga\Authentication\Auth;
8+
use Icinga\Exception\ConfigurationError;
79
use Icinga\Module\Graphite\Forms\TimeRangePicker\TimeRangePickerTrait;
810
use Icinga\Module\Graphite\Graphing\GraphingTrait;
911
use Icinga\Module\Graphite\Graphing\Template;
@@ -317,7 +319,22 @@ protected function getGraphsList()
317319

318320
public function render()
319321
{
320-
$result = $this->getGraphsList();
322+
try {
323+
$result = $this->getGraphsList();
324+
} catch (ConfigurationError $e) {
325+
$view = $this->view();
326+
327+
return "<p>{$view->escape($e->getMessage())}</p>"
328+
. '<p>' . vsprintf(
329+
$view->escape($view->translate('Please %scorrect%s the configuration of the Graphite module.')),
330+
Auth::getInstance()->hasPermission('config/modules')
331+
? explode(
332+
'$LINK_TEXT$',
333+
$view->qlink('$LINK_TEXT$', 'graphite/config/backend', null, ['class' => 'action-link'])
334+
)
335+
: ['', '']
336+
) . '</p>';
337+
}
321338

322339
if ($result === '' && $this->getShowNoGraphsFound()) {
323340
$view = $this->view();

0 commit comments

Comments
 (0)