diff --git a/src/Module/Special/HTTPException.php b/src/Module/Special/HTTPException.php index 8b520f6b5a..0cd7817ed4 100644 --- a/src/Module/Special/HTTPException.php +++ b/src/Module/Special/HTTPException.php @@ -70,8 +70,17 @@ class HTTPException $content = ''; if ($e->getCode() >= 400) { - $tpl = Renderer::getMarkupTemplate('http_status.tpl'); - $content = Renderer::replaceMacros($tpl, self::getVars($e)); + $vars = self::getVars($e); + try { + $tpl = Renderer::getMarkupTemplate('http_status.tpl'); + $content = Renderer::replaceMacros($tpl, $vars); + } catch (\Exception $e) { + $content = "
{$vars['$message']}
"; + if (DI::app()->isSiteAdmin()) { + $content .= "{$vars['$thrown']}
"; + $content .= "{$vars['$trace']}"; + } + } } System::httpError($e->getCode(), $e->getDescription(), $content);