Skip to content

Commit

Permalink
Catch exceptions in MenuItemRenderers
Browse files Browse the repository at this point in the history
fixes #7157
  • Loading branch information
majentsch committed Sep 10, 2014
1 parent 9c2cf0b commit 27960fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion library/Icinga/Web/MenuRenderer.php
Expand Up @@ -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
Expand Down Expand Up @@ -106,7 +107,11 @@ public function endChildren()
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>',
Expand Down

0 comments on commit 27960fc

Please sign in to comment.