Skip to content
Snippets Groups Projects
Verified Commit c86d174b authored by Isabella Skořepová's avatar Isabella Skořepová
Browse files

Fix crash with wrong template

+ add log filter for use in templates
parent 28e10654
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,11 @@ env.addFilter('paginationList', function(page, count) { ...@@ -36,7 +36,11 @@ env.addFilter('paginationList', function(page, count) {
}); });
env.addFilter('inspect', function(obj) { env.addFilter('inspect', function(obj) {
return util.inspect(obj); return util.inspect(obj);
});
env.addFilter('log', function(obj) {
return console.log(obj);
}); });
env.addFilter('relURL', function(filename, dir){ env.addFilter('relURL', function(filename, dir){
...@@ -53,6 +57,13 @@ module.exports = function(data, type) { ...@@ -53,6 +57,13 @@ module.exports = function(data, type) {
resolve(tmpl); resolve(tmpl);
}); });
}).then(function(tmpl) { }).then(function(tmpl) {
return tmpl.render(data); return new Promise(function(resolve, reject){
tmpl.render(data, function(err, val) {
if(err) {
reject(err);
}
resolve(val);
});
})
}); });
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment