RPTools / maptool

Virtual Tabletop for playing roleplaying games with remote players or face to face.
http://rptools.net
GNU Affero General Public License v3.0
787 stars 259 forks source link

[Bug]: createToken() should have better exception error messages #4926

Open Azhrei opened 1 week ago

Azhrei commented 1 week ago

Describe the Bug

createToken() has many, many options, but when something goes wrong, a single generic exception message is generated. The message should be directly related to the field that caused the exception.

(It would be nice if all parameters could be validated and references to all failing fields were provided, but that is likely to make the exception message excessively long.)

To Reproduce

See this Discord thread by @tdufor sample code and some discussion.

Expected Behaviour

When there's an error accessing a particular resource, say so, whether it's the name parameter, tokenImage parameter, or something else. Also report parameters that have invalid values by including both the parameter name and the list of valid values (or range of valid values, as appropriate).

Screenshots

No response

MapTool Info

Version: 1.14.3 (as well as older and newer versions)

Desktop

OS: All supported

Additional Context

No response