Skip to content

improve: add assertions to improve error message quality#7634

Merged
vadi2 merged 1 commit intoMudlet:developmentfrom
ZookaOnGit:guiutils-2890
Jan 13, 2025
Merged

improve: add assertions to improve error message quality#7634
vadi2 merged 1 commit intoMudlet:developmentfrom
ZookaOnGit:guiutils-2890

Conversation

@ZookaOnGit
Copy link
Copy Markdown
Contributor

Brief overview of PR changes/additions

Add assertions to improve error message quality such as checking of argument types.

Motivation for adding to Mudlet

Better scripting experience. More understandable error messages.

Other info (issues closed, discussion etc)

closes #2890
/claim #2890

@ZookaOnGit ZookaOnGit requested a review from a team as a code owner January 2, 2025 10:25
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Jan 2, 2025

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

Copy link
Copy Markdown
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
@Kebap would you like to test?

@vadi2 vadi2 merged commit c5eae47 into Mudlet:development Jan 13, 2025
@ZookaOnGit ZookaOnGit deleted the guiutils-2890 branch January 15, 2025 01:50
vadi2 pushed a commit that referenced this pull request Mar 26, 2025
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Some copy and paste mistakes resulted in some error messages saying
wrong function
#### Motivation for adding to Mudlet

#### Other info (issues closed, discussion etc)
came from #7634
ZookaOnGit pushed a commit that referenced this pull request Apr 23, 2025
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Fix createConsole rejecting all window names.

#### Motivation for adding to Mudlet
I was testing a PR and found that I couldn't create a console.

#### Other info (issues closed, discussion etc)
#7634 added a type check on wrong variable, instead of fixing it, I'll
just rename the uses of the local variable to be consistent with others
@Sanaki
Copy link
Copy Markdown
Contributor

Sanaki commented Aug 15, 2025

Just switched to a testing version and got hit with this. I can fix it just fine for my own scripts, but this -does- break scripts. Previously gmcp values could be fed directly to gauges in string form, now they choke on the assert and require manual coercion. Perhaps it would be better to assert(tonumber(var)) where numbers are required instead?

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Aug 15, 2025

Agreed, we don't intend to break existing scripts for the sake of correctness.

@ZookaOnGit
Copy link
Copy Markdown
Contributor Author

without checking, for which function?

@Sanaki
Copy link
Copy Markdown
Contributor

Sanaki commented Aug 16, 2025

I noticed it with setGauge, but it likely applies to more than just that one. Apologies, I had meant to mention that in the prior message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weird error messages from GUIUtils.lua

3 participants