Catch exceptions in MenuItemRenderers

fixes #7157
This commit is contained in:
Matthias Jentsch 2014-09-10 14:38:11 +02:00
parent 9c2cf0bd0f
commit 27960fc628
1 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@
namespace Icinga\Web;
use RecursiveIteratorIterator;
use Icinga\Logger\Logger;
/**
* A renderer to draw a menu with its sub-menus using an unordered html list
@ -106,7 +107,11 @@ class MenuRenderer extends RecursiveIteratorIterator
public function renderChild(Menu $child)
{
if ($child->getRenderer() !== null && $this->useCustomRenderer) {
return $child->getRenderer()->render($child);
try {
return $child->getRenderer()->render($child);
} catch (Exception $e) {
Logger::error('Could not invoke custom renderer. Exception: '. $e->getMessage());
}
}
return sprintf(
'<a href="%s">%s%s</a>',