From 1c720ce9f3a97b163dbf66cfd87db902ca7a98bf Mon Sep 17 00:00:00 2001 From: s2 Date: Fri, 7 Feb 2020 17:26:35 +0100 Subject: [PATCH] when compile throws an exception, log it to the console --- ejs-render-remote.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ejs-render-remote.js b/ejs-render-remote.js index ed93530..860ad5c 100644 --- a/ejs-render-remote.js +++ b/ejs-render-remote.js @@ -66,7 +66,13 @@ $.get(templateUrl) .then(function(template) { var templateOptions = overwriteWithCacheOptions(options, templateUrl); - var templateFn = ejs.compile(template, templateOptions); + try { + var templateFn = ejs.compile(template, templateOptions); + } catch(ex) { + console.error(templateUrl, ex); + d.reject(ex); + throw ex; + } ejs.cache.set(templateUrl, templateFn); d.resolve(templateUrl);