Merge branch 'trap-template-errors' into 'dev'

Trap errors in template rendering.  Output a generic error and log problem.

See merge request hubzilla/core!1274
This commit is contained in:
Mario 2018-09-17 11:03:37 +02:00
commit eefa47776b

View File

@ -37,7 +37,13 @@ function replace_macros($s, $r) {
call_hooks('replace_macros', $arr);
$t = App::template_engine();
$output = $t->replace_macros($arr['template'], $arr['params']);
try {
$output = $t->replace_macros($arr['template'], $arr['params']);
} catch (Exception $e) {
logger("Unable to render template: ",$e->getMessage());
$output = "<h3>ERROR: there was an error creating the output.</h3>";
}
return $output;
}