Skip to content

inconsistent behaviour with withFailOnUnknownTokens #1235

@rhomkar30

Description

@rhomkar30

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions