You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there is something wrong in the htl template (like trying to access it.dummy.property which does not exist for exampl), the error log you get in the whole Petridish setup (and probably the same in the production setup) is something like:
[hlx] error: Error while rendering the resource: TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at lengthOf (../project-helix/modules/helix-helpx/.hlx/build/html.js:295:53)
at ../project-helix/modules/helix-helpx/.hlx/build/html.js:442:28
at Generator.next (<anonymous>)
at onFulfilled (../project-helix/modules/helix-helpx/node_modules/co/index.js:65:19)
at ../project-helix/modules/helix-helpx/node_modules/co/index.js:54:5
at new Promise (<anonymous>)
at co (../project-helix/modules/helix-helpx/node_modules/co/index.js:50:10)
at Runtime.run (../project-helix/modules/helix-helpx/node_modules/@adobe/htlengine/src/runtime/Runtime.js:47:12)
at run (../project-helix/modules/helix-helpx/.hlx/build/html.js:305:20)
at main (../project-helix/modules/helix-helpx/.hlx/build/html.js:482:12)
at getContextPath.catch.then (../project-helix/modules/helix-helpx/.hlx/build/html.js:240:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
Which gives not hint on what is wrong in the template. It is crucial for development to output a meaningful error that helps locating the issue.
The text was updated successfully, but these errors were encountered:
kptdobe
changed the title
Improve error logs
Improve error logs to help locating the issue in the HTL template
Jul 10, 2018
Adding something like if (!c) return 0; would already nicely address the issue. (what I've done by using withCodeTemplate and a custom template with that fix). But some more proper checks would be better.
Is this Issue also related to parser errors (since the points in the above comments talk about the rendering phase, although the Title is not specific about them) ?
However, there is not a lot of context (the line numbers are from the input string, not the complete file), so finding the issue based on the outputted characters is very hard.
line 1:10 token recognition error at: '/'
Adding console.log(offendingSymbol.source[1].strdata) to the output before throwing would at least show the parser input, and using the line and column info you could isolate the correct line, and add ^^^^ characters to point to the right column:
${foo.bar</p>
^
And/or include some more information in the Error that is thrown, so others could do something similar.
When there is something wrong in the htl template (like trying to access it.dummy.property which does not exist for exampl), the error log you get in the whole Petridish setup (and probably the same in the production setup) is something like:
Which gives not hint on what is wrong in the template. It is crucial for development to output a meaningful error that helps locating the issue.
The text was updated successfully, but these errors were encountered: