Merge pull request #1121 from shinypb/undefined_partial_error_message

Include partial name in 'undefined partial' exception message
This commit is contained in:
Kevin Decker
2015-10-19 12:01:39 -05:00
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ HandlebarsEnvironment.prototype = {
extend(this.partials, name);
} else {
if (typeof partial === 'undefined') {
throw new Exception('Attempting to register a partial as undefined');
throw new Exception(`Attempting to register a partial called "${name}" as undefined`);
}
this.partials[name] = partial;
}
+1 -1
View File
@@ -103,7 +103,7 @@ describe('partials', function() {
shouldThrow(function() {
var undef;
handlebarsEnv.registerPartial('undefined_test', undef);
}, Handlebars.Exception, 'Attempting to register a partial as undefined');
}, Handlebars.Exception, 'Attempting to register a partial called "undefined_test" as undefined');
});
it('rendering template partial in vm mode throws an exception', function() {