Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simply added double quote to partial not found error message ##1450 #1954

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/handlebars/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ export function invokePartial(partial, context, options) {
}

if (partial === undefined) {
throw new Exception('The partial ' + options.name + ' could not be found');
throw new Exception(
'The partial "' + options.name + '" could not be found'
);
} else if (partial instanceof Function) {
return partial(context, options);
}
Expand Down
11 changes: 7 additions & 4 deletions spec/partials.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ describe('partials', function () {
return 'missing';
})
.withPartial('dude', '{{name}} ({{url}}) ')
.toThrow(Handlebars.Exception, 'The partial missing could not be found');
.toThrow(
Handlebars.Exception,
'The partial "missing" could not be found'
);
});

it('partials with context', function () {
Expand Down Expand Up @@ -156,7 +159,7 @@ describe('partials', function () {
it('rendering undefined partial throws an exception', function () {
expectTemplate('{{> whatever}}').toThrow(
Handlebars.Exception,
'The partial whatever could not be found'
'The partial "whatever" could not be found'
);
});

Expand All @@ -174,7 +177,7 @@ describe('partials', function () {
it('rendering template partial in vm mode throws an exception', function () {
expectTemplate('{{> whatever}}').toThrow(
Handlebars.Exception,
'The partial whatever could not be found'
'The partial "whatever" could not be found'
);
});

Expand Down Expand Up @@ -472,7 +475,7 @@ describe('partials', function () {

expectTemplate(
'{{#with .}}{{#*inline "myPartial"}}success{{/inline}}{{/with}}{{> myPartial}}'
).toThrow(Error, /myPartial could not/);
).toThrow(Error, /"myPartial" could not/);
});

it('should override global partials', function () {
Expand Down
Loading