Merge pull request #1121 from shinypb/undefined_partial_error_message
Include partial name in 'undefined partial' exception message
This commit is contained in:
@@ -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
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user