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

Bug Report: try/catch not working properly in scripts #3031

Open
2 tasks done
cyn0x8 opened this issue Jul 15, 2024 · 0 comments
Open
2 tasks done

Bug Report: try/catch not working properly in scripts #3031

cyn0x8 opened this issue Jul 15, 2024 · 0 comments
Labels
status: pending triage The bug or PR has not been reviewed yet. type: minor bug Involves a minor bug or issue.

Comments

@cyn0x8
Copy link
Contributor

cyn0x8 commented Jul 15, 2024

Issue Checklist

  • I have properly named the issue
  • I have checked the issues/discussions pages to see if the issue has been previously reported

What platform are you using?

Itch.io (Downloadable Build) - Windows

If you are playing on a browser, which one are you using?

None

Version

0.4.1

Context (Provide images, videos, etc.)

while a try/catch block in scripts do prevent errors, they do not work properly...

if the expression fails:

  • the rest of the try block doesnt run
  • the catch block doesnt run
  • the entire rest of the function doesnt run

a "wrapper" can be used to prevent this from happening, but its not possible to get the error

private function try_exp(func:()->Void, ?caught:()->Void):Void {
    var try_block:()->Null<Bool> = function():Null<Bool> {
      var success:Bool = true;
      try {func();} catch (e:Dynamic) {}
      return success;
    };
    
    if (try_block() != true && caught != null) {caught();}
}

Steps to reproduce (or crash logs, errors, etc.)

in a script, run a function with traces around a try/catch block that is guaranteed to run into an error

@cyn0x8 cyn0x8 added status: pending triage The bug or PR has not been reviewed yet. type: minor bug Involves a minor bug or issue. labels Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pending triage The bug or PR has not been reviewed yet. type: minor bug Involves a minor bug or issue.
Projects
None yet
Development

No branches or pull requests

1 participant