Search code examples
try-catchhaxeopenflhxcpp

How to make FlashDevelop show line error and where it happened with Haxe?


I've been using Haxe for a while and I'm debuging with the Windows target (OpenFL).

When I put a try/catch somewhere it just says for example "Null object reference" - it doesn't say the line number and the class, so I have to keep putting traces to find in which line it has thrown the error.

Can someone help me?


Solution

  • You might need to enable stack traces by adding the following define to your project.xml file if you're compiling in release mode:

    <haxedef name="HXCPP_STACK_LINE" />
    

    Also, you won't be able to catch null reference exceptions or get stack traces for them unless the following is defined (for performance reasons):

    <haxedef name="HXCPP_CHECK_POINTER" />
    

    With these two, you should see a stack trace in FlashDevelop's Output panel.

    You can find some good info on these flags and hxcpp debugging in general here. You might also want to check out the crashdumper library.