If the partial is not found, an exception should be thrown

This commit is contained in:
wycats
2010-12-29 19:23:23 -08:00
parent c19f06b4ee
commit 1974aa5277
+3 -1
View File
@@ -615,7 +615,9 @@ Handlebars.VM = {
return new Handlebars.JavaScriptCompiler().compile(environment); return new Handlebars.JavaScriptCompiler().compile(environment);
}, },
invokePartial: function(partial, name, context, helpers, partials) { invokePartial: function(partial, name, context, helpers, partials) {
if(partial instanceof Function) { if(partial === undefined) {
throw new Handlebars.Exception("The partial " + name + " could not be found");
} else if(partial instanceof Function) {
return partial(context, helpers, partials); return partial(context, helpers, partials);
} else { } else {
partials[name] = Handlebars.VM.compile(partial); partials[name] = Handlebars.VM.compile(partial);