Skip to content

[BUG] Specified Type Hint in catch causes crash in Haxe / NxScript parser #26

Description

@senioritaelizabeth
  • NxScript version: github latest
  • Haxe version: ?.?.?
  • Branch: main
  • Using DCE: not related
  • Affected targets: all

Checklist

  • I tried reproducing this issue using the NxScript parser
  • This issue is parser-specific (skip the above)

What is this related to?

  • Parsers
  • Compiler
  • Runtime (VM / bytecode execution)
  • Interpreter
  • Performance
  • I'm not sure yet

Code snippet reproducing the issue

try {
  // .. code
} catch (e: Error) { }

Observed behavior

You cannot specify a type hint for e, which causes it to be unrecognized
Additionally, exceptions thrown from external Haxe function calls inside a try/catch are not properly caught by the script runtime.

Example cases include:

  • Calling native Haxe functions inside a try
  • CALL_METHOD execution paths

In these situations, the exception escapes the script try/catch block and crashes instead of being handled by the script.

This appears to happen because errors thrown outside script-defined functions are not wrapped or forwarded back into the script exception handler.


Expected behavior

Work lol

Logs / Console output / Screenshots

Prefer text logs over screenshots. Use code blocks for console output. Attach a file if the output is too large.

<output here>

Additional information (optional)

Anything that may not be directly related to NxScript: shadowclasses, specific targets, macros, external libraries, unusual setup, etc.

<additional information>

NxScript implementation details (optional)

Only if your setup is unusual.

// optional code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions