Templater icon indicating copy to clipboard operation
Templater copied to clipboard

Improve error messages in console

Open Zachatoo opened this issue 6 months ago • 1 comments

Is your feature request related to a problem? Please describe.

Today, error messages in the console aren't very helpful. They don't tell you which template is causing the issue or which line is causing the issue.

Describe the solution you'd like

I'd like the stack trace to include where in the user's code the error occurred. It doesn't have to be the root of the stack trace, but it should be included somewhere in the stack trace or error message.

Additional context

image

Zachatoo avatar Jan 06 '24 06:01 Zachatoo

Looks like this will require a change to rusty_engine. There's already some code in there to have better error messages for specific types of syntax errors (missing closing %>, for example). I'm not sure on the effort it would take to add similar error messages for other types of errors, as I'm not very familiar with rust.

Templater Error: Template parsing error, aborting. 
 Missing closing command tag at line 1 col 3:

<%* console.log("I have no closing tag!!")
  ^

Zachatoo avatar Jan 09 '24 03:01 Zachatoo