assemble/grunt-assemble-i18n

Stack overflow on language in front matter

ain opened this issue · 4 comments

ain commented

Having a page with front matter of

language: <%= language %>

will result in Warning: Maximum call stack size exceeded as reported in #35.

You're trying to assign the variable to itself, which then gets processed looking for the same variable over and over again, so it's going to give you a call stack error. This has nothing to do with the plugin, helpers, or assemble, but how processing a template works. That's why the example shows:

lang: <%= language %>
ain commented

I know I wrote the example. I was just wondering if we could fail more gracefully.

This processing is done in assemble. You could open an issue there and maybe we can do some exception handling to catch the lodash processing. However, I don't know a way to get the actual property causing the call stack exception, but we could at least give the message that it happened during some data template expansion.

ain commented

It's definitely a very low priority case. If user is not aware of something, stack overflows will inevitably happen and the warnings will be there of all sorts. Let's keep it in the logs, there're more important things to deal with.