Merge pull request #11819 from fabrixxm/fix/wsod

Fix WSOD when Renderer throws exception
This commit is contained in:
Hypolite Petovan 2022-08-05 09:40:48 -04:00 committed by GitHub
commit d847d155ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -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 = "<h1>{$vars['$title']}</h1><p>{$vars['$message']}</p>";
if (DI::app()->isSiteAdmin()) {
$content .= "<p>{$vars['$thrown']}</p>";
$content .= "<pre>{$vars['$trace']}</pre>";
}
}
}
System::httpError($e->getCode(), $e->getDescription(), $content);