[HaxeDevelop] ignoring caught exceptions?

Hi, I’m pretty new to Haxe and I spent the last weeks porting a rather big as3 game, learning quite a lot on the way

Now the game is starting to run, to the point where something breaks and I fix it : rinse, repeat :slight_smile:

My problem is that caught exceptions are stopping code execution : Haxedevelop requires me to hit the green “play” button on every single caught exception ^^

For example when using Reflect.setProperty : Reflect first tries to access a setter, (inside a try/catch block) and when there is no setter I get a “[Fault] exception, information=ReferenceError: Error #1069” in HaxeDevelop’s output and I have to click to resume code execution.

Is this expected behavior ? I never used try/catch much with as3 and the few times I did the try part was not supposed to fail :slight_smile:

More importantly : is there a way to ignore it ? And only have uncaught errors to interrupt code execution ?

I use Reflection quite a lot, mostly to load external data into objects, and I’m rebuilding the UI using stablexui which also uses Reflection… that is quickly adding to an insane number of unneeded interruptions :smile:

Thanks !

Ok so it looks like it was as simple as unchecking “Debug” -> “Break On All Errors” :slight_smile:

problem solved !

I use Reflect.hasField before Reflect.setProperty to double-check that the field exists, that way you don’t need a try/catch :slight_smile:

Hey singmajesty, thanks for your reply :slight_smile:

I’m not doing any try/catch myself : I have some in the code because as3hx conversion turned out that way but I’m removing them progressively.

The try/catch that were bothering me were not in my code though : they came from stablexui using Reflect, and Reflect.setProperty doing a try/catch. It tries first to call a setter for the property, at least when exporting to flash target (my final target is c++, flash is for testing and debugging).
So for every Reflect.setProperty call on a property that doesn’t have a setter you get a caught error on flash target.

On Reflect.hasField : my current understanding is that it won’t “see” getters/setters, am I right ?
Also I’m still very new to this and there’s some kind of warning on Reflect.hasField that says it’s not guaranteed to work on non-anonymous structures (which I understand as “Dynamic” for now)

I’m not using Reflect everywhere, in case you’re wondering :slight_smile: I created a custom system for our game that handles animations, sounds and all kind of visual effects. And a WYSIWYG editor for it. The code that loads that data in game is the part that uses Reflect most :slight_smile:

So when that part of the game started working again I got litteraly overwhelmed with caught errors interruptions :smile: I didn’t think about looking at the debug menu until the next morning, and instead started searching the net, looking at my projetc file etc and finally post here ^^

Looks like I wrote a long post ^^

Oh, yeah, you’re right… I forget.

You can check for "get_" + propertyName for getters, and "set_" + propertyName and it should generally work. There’s also a way to check properties of the class type for the object, but some of this may be more expensive than try/catch

Good to know ! Thanks

That’s a bit like what the Reflect class does with setProperty on flash target, could be useful at some point I’ll remember this :slight_smile: