Shopify / liquid

Liquid markup language. Safe, customer facing template language for flexible web apps.
https://shopify.github.io/liquid/
MIT License
11.05k stars 1.38k forks source link

Possible to get full object & variable name with `strict_variables: true`? #1782

Open namolnad opened 8 months ago

namolnad commented 8 months ago

Hi there,

My organization uses strict_variables: true to determine when a variable is undefined, and though this works well, the error messages lack full context, which means I have difficulty passing proper instruction to my customers. As an example, if my customers template is something like: "Hello {{ customer.full_name }}, I am {{ sender.full_name }}" and the sender object is missing altogether or is missing the first_name key, then the error returned to me by liquid would be undefined variable full_name. This makes it non-trivial to determine whether the customer object might be missing/incomplete or if the sender object might be missing/incomplete, and thus it becomes very difficult to tell my customer what they should do to fix the error.

Am I missing some easier way to determine this info? Or would it be possible to adjust the error message returned to pass along the entirety of the context for this scenario?

Thanks!