Skip to content

Is it possible to get the line number in the ejs errors? #119

@IonicaBizau

Description

@IonicaBizau

I originally posted this question on StackOverflow. This is the original post:

(Suppose) I have a huge ejs file containing JavaScript snippets. When I compile it, I get the following error:

SyntaxError: Unexpected token ) in mytemplate.ejs while compiling ejs

While it's obvious there is a syntax error in my template, I can't know where the error is.

I have full access to the error object so, I was thinking if somewhere the error contains the line with the problem (in a similar way like the JavaScript engines tell you that there is a problem on a specific line).

I tried to access the err.stack field, but it only shows me the error origin (which comes from the ejs library), so that's not really helpful.

Is there a way to know where the syntax error is in the ejs file?

I'm using the ejs package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions