Dashboard: Better implementation of handling errors

refs #6412
This commit is contained in:
Marius Hein 2014-06-05 16:07:40 +02:00
parent 151f058286
commit 20b43a92f1
3 changed files with 13 additions and 5 deletions

View File

@ -143,7 +143,7 @@ class DashboardController extends ActionController
$dashboard->activate($pane);
}
$this->view->configPath = IcingaConfig::$configDir . DIRECTORY_SEPARATOR . self::DEFAULT_CONFIG;
$this->view->configPath = IcingaConfig::resolvePath(self::DEFAULT_CONFIG);
if ($dashboard === null) {
$this->view->title = 'Dashboard';

View File

@ -9,11 +9,13 @@
<div class="content">
<h1>No dashboard configuration found!</h1>
<p>
We tried to load a dashboard configuration with no success.
Please have look that the configuration does exist:
<?=
$this->translate('We tried to load a dashboard configuration with no success.'
. ' Please have look that the configuration does exist:');
?>
<code>
<?= $this->configPath ?>.ini
<?= $this->escape($this->configPath) ?>.ini
</code>
</p>
</div>

View File

@ -31,6 +31,7 @@ namespace Icinga\Web\Widget;
use Icinga\Application\Icinga;
use Icinga\Application\Config as IcingaConfig;
use Icinga\Exception\ConfigurationError;
use Icinga\Exception\ProgrammingError;
use Icinga\Web\Widget\AbstractWidget;
use Icinga\Web\Widget\Dashboard\Pane;
@ -305,7 +306,12 @@ class Dashboard extends AbstractWidget
$active = $this->setDefaultPane();
}
}
return isset($this->panes[$active]) ? $this->panes[$active] : null;
if (isset($this->panes[$active])) {
return $this->panes[$active];
}
throw new ConfigurationError('Could not determine active pane');
}
/**