Add detailed error messages for admin user in Core\Renderer and Render\FriendicaSmartyEngine
This commit is contained in:
parent
64e89a516d
commit
8b05af176c
|
@ -86,7 +86,10 @@ class Renderer
|
||||||
$output = $t->replaceMacros($template, $vars);
|
$output = $t->replaceMacros($template, $vars);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
DI::logger()->critical($e->getMessage(), ['template' => $template, 'vars' => $vars]);
|
DI::logger()->critical($e->getMessage(), ['template' => $template, 'vars' => $vars]);
|
||||||
throw new InternalServerErrorException(DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator or check the Friendica log for errors.'));
|
$message = is_site_admin() ?
|
||||||
|
$e->getMessage() :
|
||||||
|
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||||
|
throw new InternalServerErrorException($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::profiler()->saveTimestamp($stamp1, "rendering", System::callstack());
|
DI::profiler()->saveTimestamp($stamp1, "rendering", System::callstack());
|
||||||
|
@ -112,7 +115,10 @@ class Renderer
|
||||||
$template = $t->getTemplateFile($file, $subDir);
|
$template = $t->getTemplateFile($file, $subDir);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
DI::logger()->critical($e->getMessage(), ['file' => $file, 'subDir' => $subDir]);
|
DI::logger()->critical($e->getMessage(), ['file' => $file, 'subDir' => $subDir]);
|
||||||
throw new InternalServerErrorException(DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator or check the Friendica log for errors.'));
|
$message = is_site_admin() ?
|
||||||
|
$e->getMessage() :
|
||||||
|
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||||
|
throw new InternalServerErrorException($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
|
DI::profiler()->saveTimestamp($stamp1, "file", System::callstack());
|
||||||
|
@ -134,8 +140,12 @@ class Renderer
|
||||||
$name = $v['name'];
|
$name = $v['name'];
|
||||||
self::$template_engines[$name] = $class;
|
self::$template_engines[$name] = $class;
|
||||||
} else {
|
} else {
|
||||||
DI::logger()->critical(DI::l10n()->t('template engine cannot be registered without a name.'), ['class' => $class]);
|
$admin_message = DI::l10n()->t('template engine cannot be registered without a name.');
|
||||||
throw new InternalServerErrorException(DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator or check the Friendica log for errors.'));
|
DI::logger()->critical($admin_message, ['class' => $class]);
|
||||||
|
$message = is_site_admin() ?
|
||||||
|
$admin_message :
|
||||||
|
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||||
|
throw new InternalServerErrorException($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,8 +174,12 @@ class Renderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::logger()->critical(DI::l10n()->t('template engine is not registered!'), ['template_engine' => $template_engine]);
|
$admin_message = DI::l10n()->t('template engine is not registered!');
|
||||||
throw new InternalServerErrorException(DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator or check the Friendica log for errors.'));
|
DI::logger()->critical($admin_message, ['template_engine' => $template_engine]);
|
||||||
|
$message = is_site_admin() ?
|
||||||
|
$admin_message :
|
||||||
|
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||||
|
throw new InternalServerErrorException($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,8 +49,12 @@ final class FriendicaSmartyEngine extends TemplateEngine
|
||||||
$this->smarty = new FriendicaSmarty($this->theme, $this->theme_info);
|
$this->smarty = new FriendicaSmarty($this->theme, $this->theme_info);
|
||||||
|
|
||||||
if (!is_writable(DI::basePath() . '/view/smarty3')) {
|
if (!is_writable(DI::basePath() . '/view/smarty3')) {
|
||||||
DI::logger()->critical(DI::l10n()->t('The folder view/smarty3/ must be writable by webserver.'));
|
$admin_message = DI::l10n()->t('The folder view/smarty3/ must be writable by webserver.');
|
||||||
throw new InternalServerErrorException(DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator or check the Friendica log for errors.'));
|
DI::logger()->critical($admin_message);
|
||||||
|
$message = is_site_admin() ?
|
||||||
|
$admin_message :
|
||||||
|
DI::l10n()->t('Friendica can\'t display this page at the moment, please contact the administrator.');
|
||||||
|
throw new InternalServerErrorException($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue