Skip to content

Fix(?) try/catch #199

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

NotHyper-474
Copy link

@NotHyper-474 NotHyper-474 commented Feb 27, 2025

Related issue: FunkinCrew/Funkin#3031

Test code:

var a:String = null;
try {
  trace(a.length);
}
catch (err:Dynamic) {
  trace("Catched error: " + err);
}

Output:
hscriptClass(assets/test.hxc):20: Catched error: hscriptClass(assets/test.hxc):14: Invalid access to field length

}
} catch( err : Dynamic ) {
// I can't handle this error the normal way because Stop is private GRAAAAA
if (Type.getEnumName(err) == "hscript.Interp.Stop") {
Copy link
Author

Choose a reason for hiding this comment

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

For some reason here it's Interp but for me it would always be _Interp. I hope this doesn't mean it changes somehow.

inTry = oldTry;
throw err;
throw error;
Copy link
Author

@NotHyper-474 NotHyper-474 Feb 27, 2025

Choose a reason for hiding this comment

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

This currently throws an error in the program itself, although we might want to use errorEx here instead? Or whatever way Polymod uses to handle errors.

@NotHyper-474 NotHyper-474 changed the title Fix try/catch? Fix(?) try/catch Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant