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

Template paths in errors when using renderString #1359

Open
kruncher opened this issue Jun 30, 2021 · 2 comments
Open

Template paths in errors when using renderString #1359

kruncher opened this issue Jun 30, 2021 · 2 comments

Comments

@kruncher
Copy link

When using renderString it is possible to supply a path representing the template that is being rendered:

nunjucksEnvironment.renderString(templateString, context, templatePath);

This works to the extend that the templatePath is output in error messages but any errors in other extended/included templates are also shown with templatePath instead of their actual paths.

How can those extended/included template paths also be shown?

@ogonkov
Copy link
Contributor

ogonkov commented Jun 30, 2021

Try dev: true, when creating your env

@kruncher
Copy link
Author

@ogonkov this seems to show a JavaScript call stack rather than the templates themselves:

Error: tag name expected
    at new TemplateError (/Users/me/git/test/node_modules/nunjucks/src/lib.js:89:17)
    at Parser.error (/Users/me/git/test/node_modules/nunjucks/src/parser.js:84:12)
    at Parser.fail (/Users/me/git/test/node_modules/nunjucks/src/parser.js:88:16)
    at Parser.parseStatement (/Users/me/git/test/node_modules/nunjucks/src/parser.js:566:12)
    at Parser.parseNodes (/Users/me/git/test/node_modules/nunjucks/src/parser.js:1211:22)
    at Parser.parseAsRoot (/Users/me/git/test/node_modules/nunjucks/src/parser.js:1239:38)
    at Object.parse (/Users/me/git/test/node_modules/nunjucks/src/parser.js:1264:14)
    at Object.compile (/Users/me/git/test/node_modules/nunjucks/src/compiler.js:1445:44)
    at Template._compile (/Users/me/git/test/node_modules/nunjucks/src/environment.js:632:29)
    at Template.init (/Users/me/git/test/node_modules/nunjucks/src/environment.js:509:14)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants