Define ContentDecodingException used by BinaryXMLDecoder.
diff --git a/js/encoding/BinaryXMLDecoder.js b/js/encoding/BinaryXMLDecoder.js
index 609bd99..461eae7 100644
--- a/js/encoding/BinaryXMLDecoder.js
+++ b/js/encoding/BinaryXMLDecoder.js
@@ -102,7 +102,7 @@
 				// DKS TODO are attributes same or different dictionary?
 				attributeName = tagToString(thisTV.val());
 				if (null == attributeName) {
-					throw new ContentDecodingException("Unknown DATTR value" + thisTV.val());
+					throw new ContentDecodingException(new Error("Unknown DATTR value" + thisTV.val()));
 				}
 			}
 			
@@ -115,7 +115,7 @@
 
 	} catch ( e) {
 
-		throw new ContentDecodingException("readStartElement", e);
+		throw new ContentDecodingException(new Error("readStartElement", e));
 	}
 };
 
@@ -145,12 +145,11 @@
 		//if(typeof startTag == 'number')
 			//startTag = tagToString(startTag);
 		
-		//try {
 			//TypeAndVal 
 			tv = this.decodeTypeAndVal();
 			
 			if (null == tv) {
-				throw new Error("Expected start element: " + startTag + " got something not a tag.");
+				throw new ContentDecodingException(new Error("Expected start element: " + startTag + " got something not a tag."));
 			}
 			
 			//String 
@@ -188,7 +187,7 @@
 			
 			if ((null ==  decodedTag) || decodedTag != startTag ) {
 				console.log('expecting '+ startag + ' but got '+ decodedTag);
-				throw new Error("Expected start element: " + startTag + " got: " + decodedTag + "(" + tv.val() + ")");
+				throw new ContentDecodingException(new Error("Expected start element: " + startTag + " got: " + decodedTag + "(" + tv.val() + ")"));
 			}
 			
 			// DKS: does not read attributes out of stream if caller doesn't
@@ -197,11 +196,6 @@
 			if (null != attributes) {
 				readAttributes(attributes); 
 			}
-			
-		//} catch ( e) {
-			//console.log(e);
-			//throw new Error("readStartElement", e);
-		//}
 	}
 	
 
@@ -242,7 +236,7 @@
 				// DKS TODO are attributes same or different dictionary?
 				attributeName = tagToString(thisTV.val());
 				if (null == attributeName) {
-					throw new Error("Unknown DATTR value" + thisTV.val());
+					throw new ContentDecodingException(new Error("Unknown DATTR value" + thisTV.val()));
 				}
 			}
 			// Attribute values are always UDATA
@@ -254,10 +248,8 @@
 
 			nextTV = this.peekTypeAndVal();
 		}
-
 	} catch ( e) {
-		Log.logStackTrace(Log.FAC_ENCODING, Level.WARNING, e);
-		throw new Error("readStartElement", e);
+		throw new ContentDecodingException(new Error("readStartElement", e));
 	}
 };
 
@@ -278,7 +270,7 @@
 
 			if (tv.type() == XML_TAG) {
 				/*if (tv.val()+1 > DEBUG_MAX_LEN) {
-					throw new ContentDecodingException("Decoding error: length " + tv.val()+1 + " longer than expected maximum length!");
+					throw new ContentDecodingException(new Error("Decoding error: length " + tv.val()+1 + " longer than expected maximum length!")(;
 				}*/
 
 				// Tag value represents length-1 as tags can never be empty.
@@ -306,7 +298,7 @@
 			this.offset = previousOffset;
 		} catch ( e) {
 			Log.logStackTrace(Log.FAC_ENCODING, Level.WARNING, e);
-			throw new ContentDecodingException("Cannot reset stream! " + e.getMessage(), e);
+			throw new ContentDecodingException(new Error("Cannot reset stream! " + e.getMessage(), e));
 		}
 	}
 	return decodedTag;
@@ -332,7 +324,7 @@
 		return false;
 	}
 	else{
-		throw new Error("SHOULD BE STRING OR NUMBER");
+		throw new ContentDecodingException(new Error("SHOULD BE STRING OR NUMBER"));
 	}
 }
 //returns Long
@@ -354,7 +346,7 @@
 
 				if (tv.type() == XML_TAG) {
 					if (tv.val()+1 > DEBUG_MAX_LEN) {
-						throw new ContentDecodingException("Decoding error: length " + tv.val()+1 + " longer than expected maximum length!");
+						throw new ContentDecodingException(new Error("Decoding error: length " + tv.val()+1 + " longer than expected maximum length!"));
 					}
 
 					var valval ;
@@ -412,7 +404,6 @@
 	
 	
 BinaryXMLDecoder.prototype.readEndElement = function(){
-		//try {
 			if(LOG>4)console.log('this.offset is '+this.offset);
 			
 			var next = this.istream[this.offset]; 
@@ -425,11 +416,8 @@
 			
 			if (next != XML_CLOSE) {
 				console.log("Expected end element, got: " + next);
-				throw new ContentDecodingException("Expected end element, got: " + next);
+				throw new ContentDecodingException(new Error("Expected end element, got: " + next));
 			}
-		//} catch ( e) {
-			//throw new ContentDecodingException(e);
-		//}
 	};
 
 
@@ -482,7 +470,7 @@
 	//timestamp.setDateBinary(byteTimestamp);
 	
 	if (null == timestamp) {
-		throw new ContentDecodingException("Cannot parse timestamp: " + DataUtils.printHexBytes(byteTimestamp));
+		throw new ContentDecodingException(new Error("Cannot parse timestamp: " + DataUtils.printHexBytes(byteTimestamp)));
 	}		
 	return timestamp;
 };
@@ -714,14 +702,7 @@
 	if(LOG>4) console.log('READING INTEGER '+ startTag);
 	if(LOG>4) console.log('TYPE OF '+ typeof startTag);
 	
-	//try {
-		
 	strVal = this.readUTF8Element(startTag);
-
-	//}
-	//catch (e) {
-		//throw new Error("Cannot parse " + startTag + ": " + strVal);
-	//}
 	
 	return parseInt(strVal);
 };
@@ -732,7 +713,7 @@
 			startTag,
 			//TreeMap<String, String> 
 			attributes) {
-			//throws ContentDecodingException 
+			//throws Error where name == "ContentDecodingException" 
 
 		this.readStartElement(startTag, attributes); // can't use getElementText, can't get attributes
 		//String 
@@ -748,3 +729,17 @@
         offset) {
     this.offset = offset;        
 }
+
+/*
+ * Call with: throw new ContentDecodingException(new Error("message")).
+ */
+function ContentDecodingException(error) {
+    this.message = error.message;
+    // Copy lineNumber, etc. from where new Error was called.
+    for (var prop in error)
+        this[prop] = error[prop];
+}
+ContentDecodingException.prototype = new Error();
+ContentDecodingException.prototype.name = "ContentDecodingException";
+
+