Ver Fonte

correctly report parsing errors

ncannasse há 9 anos atrás
pai
commit
87ee0be584
1 ficheiros alterados com 8 adições e 1 exclusões
  1. 8 1
      hxd/res/DynamicText.hx

+ 8 - 1
hxd/res/DynamicText.hx

@@ -112,7 +112,14 @@ class DynamicText {
 
 	public static function build( file : String, ?withDict : Bool ) {
 		var path = FileTree.resolvePath();
-		var x = Xml.parse(sys.io.File.getContent(path + "/" + file));
+		var fullPath = path + "/" + file;
+		var x = null;
+		try {
+			x = Xml.parse(sys.io.File.getContent(fullPath));
+		} catch( e : haxe.xml.Parser.XmlParserException ) {
+			Context.error(e.message, Context.makePosition({min:e.position, max:e.position, file:fullPath}));
+			return null;
+		}
 		Context.registerModuleDependency(Context.getLocalModule(), path + "/" + file);
 		var fields = Context.getBuildFields();
 		var pos = Context.currentPos();