Skip to content

Improve error messages resulting from javascript code in a template #175

@ex-daniel-graupner

Description

@ex-daniel-graupner

Vento provides great error messages for errors in vento syntax.
However, vento templates allow to place javascript code inside templates using the tag {{>. If this code contains errors, Vento does not provide a useful call stack in the error message.

Consider the simple template:

test
{{> cosole.log("sd")}}

It has a syntax error in javascript, at runtime I get a ReferenceError exception, which is OK.
However, the exception call stack does not point to the issue:

`ReferenceError: Template execution for test.vto failed: cosole is not defined
    at eval (eval at __template (eval at compile (file:///.../node_modules/ventojs/core/environment.js:90:33)), <anonymous>:7:1)
    at __template (eval at compile (file:///.../node_modules/ventojs/core/environment.js:90:33), <anonymous>:15:10)
    at ...

For more complex templates and more tricky errors this may be hard to debug.
Can you provide at least the template file and a line number for the error in the Exception?

I use VentoJs with nodejs native TS support, Node version is v25.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions