Skip to content
New issue

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

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

Already on GitHub? # to your account

Question - No error when filter is unknown #208

Closed
danielmartinezruiz opened this issue Aug 5, 2021 · 2 comments
Closed

Question - No error when filter is unknown #208

danielmartinezruiz opened this issue Aug 5, 2021 · 2 comments

Comments

@danielmartinezruiz
Copy link
Contributor

This problem was raised when writing a template and I misspell a filter. This could be an example:

{{ "abc" | uper }}

This is the code I'm executing:

std::string source = R"({{ "abc" | uper }})";
jinja2::Template tpl;
tpl.Load(source);
std::string result = tpl.RenderAsString(ValuesMap{}).value();

I expected to receive an error in the expected return value, but I received a value with an empty string "". In an online Jinja2 parser (I guess it is not using this library) I get this result:

Error:·template·rendering·failed.
no·filter·named·'uper'

So, is that empty string the expected behavior? Am I doing anything wrong?

@rmorozov
Copy link
Member

rmorozov commented Aug 9, 2021

@danielmartinezruiz , @luismartingil, I've merged your PR. Seems good for now?

@danielmartinezruiz
Copy link
Contributor Author

danielmartinezruiz commented Aug 9, 2021

@danielmartinezruiz , @luismartingil, I've merged your PR. Seems good for now?

Thanks, @rmorozov!
Are you planning to release a new version?

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

No branches or pull requests

2 participants