1
0
mirror of https://github.com/S2-/ejs-render-remote synced 2025-08-02 12:40:04 +02:00

add more logs

This commit is contained in:
s2
2020-02-08 17:57:05 +01:00
parent 9aba0176f4
commit af63b77c9b

View File

@@ -25,7 +25,12 @@
//if the template is already cached, return it and we are done //if the template is already cached, return it and we are done
if (templateFn) { if (templateFn) {
return templateFn(data); try {
return templateFn(data);
} catch(ex) {
console.error(ex);
throw ex;
}
} else { //if the template is not cached, we need to get it and render it later once we have it. remember: this happens only if the template is not already cached } else { //if the template is not cached, we need to get it and render it later once we have it. remember: this happens only if the template is not already cached
@@ -69,17 +74,16 @@
} else { } else {
$.get(templateUrl) $.get(templateUrl)
.then(function(template) { .then(function(template) {
var templateOptions = overwriteWithCacheOptions(options, templateUrl);
try { try {
var templateOptions = overwriteWithCacheOptions(options, templateUrl);
var templateFn = ejs.compile(template, templateOptions); var templateFn = ejs.compile(template, templateOptions);
ejs.cache.set(templateUrl, templateFn);
d.resolve(templateUrl);
} catch(ex) { } catch(ex) {
console.error(templateUrl, ex); console.error(templateUrl, ex);
d.reject(ex); d.reject(ex);
throw ex; throw ex;
} }
ejs.cache.set(templateUrl, templateFn);
d.resolve(templateUrl);
}); });
} }