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

ScriptLoader - fix error catching #7410

Conversation

ShaneBeee
Copy link
Contributor

Description

This PR aims to fix an issue with ScriptLoader not catching Throwables which aren't Exceptions (ie: StackOverflowError)

I noticed this while doing a test in Dev mode.
I made a booboo in SkBee here the toString of a condition was recursively calling itself.
Unfortunately the test just halted, it wouldn't fail, it wouldn't throw a StackOverflowError

Exhibit A:
Screenshot 2025-01-06 at 2 40 35 PM

Then I moved onto a script to test (not a Test test, just running a script).
I had a similar issue.
Exhibits B and C:
Screenshot 2025-01-06 at 2 39 34 PM
Screenshot 2025-01-06 at 2 39 21 PM

The parser just halted. No error, no stack overflow, nothing.

After a lengthy talk with Pickle, he came to the idea that it had to do with the CompletableFutures, as they weren't catching anything.
There are a bunch of Try/Catches in the ScriptLoader, but they catch Exceptions not Throwables.
StackOverflowError extends from Throwable, not exception.

By attaching an "Exceptionally" to the CF, we're able to catch all those pesky overflows (and other throwables)


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

@Efnilite Efnilite added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Jan 7, 2025
@Moderocky Moderocky merged commit b0df396 into SkriptLang:dev/feature Jan 7, 2025
5 checks passed
@ShaneBeee ShaneBeee deleted the shane/scriptloader-fix-error-catching branch January 7, 2025 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

3 participants