Skip to content

Commit

Permalink
Throw error if partial not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef Kababe committed Oct 17, 2015
1 parent b01422a commit 59d6fb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions helpers/partial.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 59d6fb5

Please sign in to comment.