Skip to content

Improve error logs to help locating the issue in the HTL template #16

@kptdobe

Description

@kptdobe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions