Informative error message for docx templates
-
Hello!
We have many tables in our docx templates. In almost every column of the table, there is a call to data, some helper, or special operators, such as:
{{#docxTable data as |line|}}{{line.name}}...
And we often encounter errors because docx editors automatically insert line breaks, breaking these constructs:
{{#docxTable data as |line|}}{{line.name}}
Which can lead to such errors:
2025-02-28T10:06:33.970Z - warn: Error when processing render request 5 (because) error while executing docx recipe (because) cannot read properties of null (reading '0') TypeError: Cannot read properties of null (reading '0')
The problem is that the error always looks exactly the same, and it’s unclear where in the template it occurs. Because of this, we spend a lot of time searching line by line, and downloading template to jsReport, for extra line breaks or spaces.
An additional complication arises because not all line breaks cause such errors. In some cases, the template breaks, while in others, it doesn’t.Is there a way to make the error more informative so that we don’t waste so much time searching line by line for the problem?
Thank you!
-
Thanks for submitting this problem here.
I've submitted a task to our backlog to add some context to the docx errors.
https://github.com/jsreport/jsreport/issues/1214I'm afraid there isn't a solution for this now, so we will try to prioritize the mentioned task.