From 59d6fb5b36d1068e8bd552954df250789c06fd01 Mon Sep 17 00:00:00 2001 From: Youssef Kababe Date: Sat, 17 Oct 2015 23:35:53 +0100 Subject: [PATCH] Throw error if partial not found --- helpers/partial.js | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/helpers/partial.js b/helpers/partial.js index 35dd7c2..1fec9aa 100644 --- a/helpers/partial.js +++ b/helpers/partial.js @@ -7,6 +7,10 @@ module.exports = function(exbars) { return function(name, context) { var dirName = path.dirname(exbars.callerPath); var partial = partials[path.join(dirName, name)] || partials[name] || partials['views/' + name]; + + if (partial === undefined) + throw new Error('Failed to lookup partial "' + name + '" in: ' + exbars.callerPath); + compiledPartial = exbars.handlebars.compile(partial, exbars.comilerOptions); return new exbars.handlebars.SafeString(compiledPartial(mix(this, context.hash))); }; diff --git a/package.json b/package.json index c6cecf0..ad1acbf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "exbars", - "version": "0.1.0", + "version": "0.1.1", "description": "A flexible Handlebars view engine for Express", "main": "index.js", "scripts": {