Error-handling is good
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Mon, 27 Jun 2011 15:59:30 -0600
changeset 328 c80d1fc8bafd
parent 327 1458537e4a06
child 329 6f528b93014b
Error-handling is good
extramethods.html
--- a/extramethods.html	Mon Jun 27 15:26:27 2011 -0600
+++ b/extramethods.html	Mon Jun 27 15:59:30 2011 -0600
@@ -18,6 +18,10 @@
 body > div > table > tbody > tr > th:last-child {
 	width: 5%;
 }
+td.alert {
+	font-weight: bold;
+	color: red;
+}
 </style>
 <p>Legend: {[ are the selection anchor, }] are the selection focus, {}
 represent an element boundary point, [] represent a text node boundary point.
@@ -172,9 +176,21 @@
 	input.removeAttribute("data-input");
 
 	var inputCell = document.createElement("td");
-	var points = setupCell(inputCell, test);
+	tr.appendChild(inputCell);
+	try {
+		var points = setupCell(inputCell, test);
+	} catch (e) {
+		tr.style.display = "table-row !important";
+		inputCell.colSpan = 5;
+		inputCell.className = "alert";
+		inputCell.textContent = "Exception: " + e;
+		inputCell.style.display = "table-cell !important";
+		tr.parentNode.appendChild(document.createElement("tr"));
+		tr.parentNode.appendChild(document.createElement("tr"));
+		tr.parentNode.appendChild(document.createElement("tr"));
+		return;
+	}
 	inputCell.rowSpan = rowCount;
-	tr.appendChild(inputCell);
 	inputCell.firstChild.contentEditable = "true";
 	inputCell.firstChild.spellcheck = false;
 
@@ -196,6 +212,8 @@
 	inputCell.firstChild.removeAttribute("spellcheck");
 	inputCell.firstChild.innerHTML = test;
 	inputCell.lastChild.textContent = inputCell.firstChild.innerHTML;
+
+	tr.className = (" " + tr.className + " ").replace(" active ", "").trim();
 }
 //@}