flixel-ui
flixel-ui copied to clipboard
The error when the xml file is not found / parsable is not easy to understand
Hi ! When I create a FlxUIState, I set the _xml_id with a filename. If this file does not exists (typo in the name, added the ".xml" to the filename, ...) or if it's not parsable (error in the XML), here is the error I get :
Invalid field access : h
Called from flixel/addons/ui/FlxUI.hx line 1354
Called from flixel/addons/ui/FlxUITooltipManager.hx line 63
Called from flixel/addons/ui/FlxUIState.hx line 206
...
It's very hard to debug. It could be interesting to have an error more explicit.
That's a haxe error, not a flixel error. But sure, having an actual error message would be good.
It's not possible to just look if _xml_id terminate with a .xml and throw an exception with a more explicit message ? Else, i have the same error when I make a mistake on my xml such missing a /.
Checking for the file ending sounds like a bad idea, there shouldn't be anything stopping your from having an xml file that doesn't end with .xml
.
It's not possible to handle both file with or without .xml ? and check both with the File exists api ?
Sure, which is why your suggestion to check for the .xml ending didn't make sense to me. :)
just look if _xml_id terminate with a .xml and throw an exception
Yeah, but in the documentation, it's say
_xml_id = "state_battle"; //looks for "state_battle.xml"
So, i don't know if flixel ui permit an _xml_id terminate with .xml, if not we need to thown an exception if the _xml_id, no ?
However I'm agree with you, the better way, its to load and permit an xml_id with ou without the xml extension.
The issue here is that there are checks in place already, but something else is happening, resulting in this obscure error. I think it has to do with initializing the tooltip manager.