浏览代码

informs which text fails to parse in HtmlText

ncannasse 10 年之前
父节点
当前提交
f65cab412a
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      h2d/HtmlText.hx

+ 2 - 1
h2d/HtmlText.hx

@@ -42,7 +42,8 @@ class HtmlText extends Text {
 		xPos = 0;
 		yPos = 0;
 		xMax = 0;
-		for( e in Xml.parse(text) )
+		var doc = try Xml.parse(text) catch( e : Dynamic ) throw "Could not parse " + text + " (" + e +")";
+		for( e in doc )
 			addNode(e, rebuild);
 		return { width : xPos > xMax ? xPos : xMax, height : xPos > 0 ? yPos + (font.lineHeight + lineSpacing) : yPos };
 	}