foundryvtt / foundryvtt

Public issue tracking and documentation for Foundry Virtual Tabletop - software connecting RPG gamers in a shared multiplayer environment with an intuitive interface and powerful API.
https://foundryvtt.com/
192 stars 10 forks source link

Forward along the original error message string from JavaScriptField#_validateType #10809

Closed Freeze023 closed 2 weeks ago

Freeze023 commented 2 weeks ago

User Experience

As is when you execute or save a macro that has an error in it the macro doesn't save and gives a fairly generic error giving no indication of what you have done wrong. And if you executed it will run whatever last version it had leading to more confusion.

Without that validation step you could at least go into the console and figure out what you did wrong or go to Macro Polo on Discord and ask if it didn't work (lets say you forgot a )).

Either the validation will have to report back what line has the error, and perhaps the type of error. Or it just shouldn't be there as it makes life harder and not easier, because a debugging step has been removed.

JPMeehan commented 2 weeks ago

Having some sort of built-in syntax highlighting would make a HUGE difference. Right now I feel like best practice is to just have notepad++ or something open.

aaclayton commented 2 weeks ago

It's possible to improve things here very slightly. The validation in place catches syntax errors only, it does not capture runtime errors or logical errors which would only be revealed upon macro execution. We can forward more of the error message that captures the syntax error though to give the resulting error message a little bit more context.

The amount of information we can return is the same as what you would get when declaring a function with a syntatic error via the console:

image

image