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:
@@ -25,7 +25,12 @@
|
||||
|
||||
//if the template is already cached, return it and we are done
|
||||
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
|
||||
|
||||
@@ -69,17 +74,16 @@
|
||||
} else {
|
||||
$.get(templateUrl)
|
||||
.then(function(template) {
|
||||
var templateOptions = overwriteWithCacheOptions(options, templateUrl);
|
||||
try {
|
||||
var templateOptions = overwriteWithCacheOptions(options, templateUrl);
|
||||
var templateFn = ejs.compile(template, templateOptions);
|
||||
ejs.cache.set(templateUrl, templateFn);
|
||||
d.resolve(templateUrl);
|
||||
} catch(ex) {
|
||||
console.error(templateUrl, ex);
|
||||
d.reject(ex);
|
||||
throw ex;
|
||||
}
|
||||
ejs.cache.set(templateUrl, templateFn);
|
||||
|
||||
d.resolve(templateUrl);
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user