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

inconsistent behaviour with withFailOnUnknownTokens #1235

Open
rhomkar30 opened this issue Feb 10, 2025 · 4 comments
Open

inconsistent behaviour with withFailOnUnknownTokens #1235

rhomkar30 opened this issue Feb 10, 2025 · 4 comments

Comments

@rhomkar30
Copy link

JinjavaConfig config = JinjavaConfig.newBuilder().withFailOnUnknownTokens(true).build();
Jinjava jinjava = new Jinjava(config);

String[] templates = new String[]{

"{% if foo == 'bar' %}baz{% endif %}"

};

for (String template : templates) {
System.out.println("Template: " + template);
try {
jinjava.render(template, new Context());
System.out.println("Works!\n");
}
catch (FatalTemplateErrorsException e) {
System.out.println("Doesn't work: " + e.getMessage() + "\n");
}
}

It doesn't throw exception as foo is not defined in the context.

@rhomkar30
Copy link
Author

Any update on this?

@jasmith-hs
Copy link
Contributor

Thanks for pointing this out. There are no updates here, but feel free to open a PR to address the issue

@rhomkar30
Copy link
Author

sorry I didn’t get you. PR you mean pull request??

@jasmith-hs
Copy link
Contributor

sorry I didn’t get you. PR you mean pull request??

Yes, pull request

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