SilentVoid13 / Templater

A template plugin for obsidian
https://silentvoid13.github.io/Templater
GNU Affero General Public License v3.0
3.21k stars 194 forks source link

Improve error messages in console #1288

Open Zachatoo opened 9 months ago

Zachatoo commented 9 months ago

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 commented 9 months ago

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!!")
  ^
Thundercraft5 commented 1 day ago

This would be very helpful, as I resort to having to console-logging the error or shotgun debugging when coding templates.