Do not crash the whole cloudron if an email template does not render but report the ejs error

This commit is contained in:
Johannes Zellner
2017-08-04 12:02:50 +02:00
parent daadefe6b9
commit ba3cb3b646

View File

@@ -149,7 +149,15 @@ function render(templateFile, params) {
assert.strictEqual(typeof templateFile, 'string');
assert.strictEqual(typeof params, 'object');
return ejs.render(safe.fs.readFileSync(path.join(MAIL_TEMPLATES_DIR, templateFile), 'utf8'), params);
var content = null;
try {
content = ejs.render(safe.fs.readFileSync(path.join(MAIL_TEMPLATES_DIR, templateFile), 'utf8'), params);
} catch (e) {
console.error(e);
}
return content;
}
function getAdminEmails(callback) {