Add a default helperMissing to help catch errors and restore old behavior

This commit is contained in:
tomhuda
2011-03-30 23:12:18 -07:00
parent 3e5bc84058
commit 2615fa4bd1
+8
View File
@@ -42,6 +42,14 @@ Handlebars.registerPartial = function(name, str) {
this.partials[name] = str;
};
Handlebars.registerHelper('helperMissing', function(arg) {
if(arguments.length === 2) {
return undefined;
} else {
throw new Error("Could not find property '" + arg + "'");
}
});
Handlebars.registerHelper('blockHelperMissing', function(context, fn, inverse) {
inverse = inverse || function() {};