$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 = "<h1>{$vars['$title']}</h1><p>{$vars['$message']}</p>";
+ if (DI::app()->isSiteAdmin()) {
+ $content .= "<p>{$vars['$thrown']}</p>";
+ $content .= "<pre>{$vars['$trace']}</pre>";
+ }
+ }
}
- System::httpExit($e->getCode(), $e->getDescription(), $content);
+ System::httpError($e->getCode(), $e->getDescription(), $content);
}
/**
header($_SERVER["SERVER_PROTOCOL"] . ' ' . $e->getCode() . ' ' . $e->getDescription());
if ($e->getCode() >= 400) {
- Logger::debug('Exit with error', ['code' => $e->getCode(), 'description' => $e->getDescription(), 'query' => DI::args()->getQueryString(), 'callstack' => System::callstack(20), 'method' => $_SERVER['REQUEST_METHOD'], 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']);
+ Logger::debug('Exit with error', ['code' => $e->getCode(), 'description' => $e->getDescription(), 'query' => DI::args()->getQueryString(), 'callstack' => System::callstack(20), 'method' => DI::args()->getMethod(), 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']);
}
$tpl = Renderer::getMarkupTemplate('exception.tpl');