Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Duplicate Secspression Logging #7409

Merged

Conversation

APickledWalrus
Copy link
Member

@APickledWalrus APickledWalrus commented Jan 6, 2025

Description

This PR fixes the issue where, if a secspression's section contains errors, the first error is duplicated.

Error Screenshots

image
image

It turns out this issue was not related to secspressions (or Kenzie) at all! The issue was caused by a missing check in TypePatternElement. It was fine to omit this check previously, as it was assumed that if errors were logged during an Expression's parsing, the Expression would fail to init (and thus parsing would fail). However, with secspressions, it is possible for the Expression itself to parse/init properly, but a child element to error. As a result, both printLog() and printError() were called on the same LogHandler, causing the duplicated error. This can be simply resolved by checking whether the LogHandler is stopped (i.e. whether it already printed logs).

Additionally, I have gone ahead and made two minor tweaks to the Secspression loading. The handler.close() call was unnecessary, as closing is already triggered by handler.printLog().


Target Minecraft Versions: any
Requirements: none
Related Issues: none

@APickledWalrus APickledWalrus added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. 2.10 Targeting a 2.10.X version release labels Jan 6, 2025
Copy link
Member

@Moderocky Moderocky left a comment

Choose a reason for hiding this comment

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

:)

@Moderocky Moderocky merged commit 622bfb4 into SkriptLang:dev/feature Jan 6, 2025
5 checks passed
@APickledWalrus APickledWalrus deleted the patch/secspression-logging branch January 6, 2025 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.10 Targeting a 2.10.X version release bug An issue that needs to be fixed. Alternatively, a PR fixing an issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants