From e36657d48c2e3c1924cc43b9d14767899a380e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 19 Feb 2018 11:17:15 -0500 Subject: [PATCH] add tpl path to error messages --- src/middleware/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/middleware/index.js b/src/middleware/index.js index b1e065b3fd..2f995f7b5d 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -211,7 +211,7 @@ middleware.templatesOnDemand = function (req, res, next) { if (!filePath.endsWith('.js')) { return next(); } - + var tplPath = filePath.replace(/\.js$/, '.tpl'); if (workingCache[filePath]) { workingCache[filePath].push(next); return; @@ -234,11 +234,11 @@ middleware.templatesOnDemand = function (req, res, next) { } workingCache[filePath] = [next]; - fs.readFile(filePath.replace(/\.js$/, '.tpl'), 'utf8', cb); + fs.readFile(tplPath, 'utf8', cb); }, function (source, cb) { if (!source) { - return cb(new Error('[[error:templatesOnDemand.source-template-empty]]')); + return cb(new Error('[[error:templatesOnDemand.source-template-empty, ' + tplPath + ']]')); } Benchpress.precompile({ source: source, @@ -247,7 +247,7 @@ middleware.templatesOnDemand = function (req, res, next) { }, function (compiled, cb) { if (!compiled) { - return cb(new Error('[[error:templatesOnDemand.compiled-template-empty]]')); + return cb(new Error('[[error:templatesOnDemand.compiled-template-empty, ' + tplPath + ']]')); } fs.writeFile(filePath, compiled, cb); },