I'm trying to test a liquid for loop where the variables do not exist. I want to render the text without throwing an error but still capture the error list. This is the case I'm testing:
String text = "{% for product in products %} {{product.image}} {% endfor %}";
Template template =
Template.parse(text)
.withRenderSettings(
new RenderSettings.Builder()
.withStrictVariables(true)
.withRaiseExceptionsInStrictMode(false)
.build());
template.render(Map.of());
System.out.println(template.errors());
--> prints empty list []
This runs without throwing as expected but the final error list is empty when I would expect it to contain any suppressed errors. If I were to remove the looping logic and simply have for example {{product.image}} as my text, then the error list populates as expected. I'm curious why the looping logic in the text is preventing the error list from populating?
I'm trying to test a liquid for loop where the variables do not exist. I want to render the text without throwing an error but still capture the error list. This is the case I'm testing:
--> prints empty list []
This runs without throwing as expected but the final error list is empty when I would expect it to contain any suppressed errors. If I were to remove the looping logic and simply have for example
{{product.image}}
as my text, then the error list populates as expected. I'm curious why the looping logic in the text is preventing the error list from populating?