Major update: Fix bug: Rename "new Exception" to "new Error" througout the project.
diff --git a/js/encoding/BinaryXMLCodec.js b/js/encoding/BinaryXMLCodec.js
index b1befdd..e6b8fef 100644
--- a/js/encoding/BinaryXMLCodec.js
+++ b/js/encoding/BinaryXMLCodec.js
@@ -61,14 +61,14 @@
offset) {
if ((type > XML_UDATA) || (type < 0) || (val < 0)) {
- throw new Exception("Tag and value must be positive, and tag valid.");
+ throw new Error("Tag and value must be positive, and tag valid.");
}
// Encode backwards. Calculate how many bytes we need:
var/*int*/ numEncodingBytes = numEncodingBytes(val);
if ((offset + numEncodingBytes) > buf.length) {
- throw new Exception("Buffer space of " + (buf.length-offset) +
+ throw new Error("Buffer space of " + (buf.length-offset) +
" bytes insufficient to hold " +
numEncodingBytes + " of encoded type and value.");
}
@@ -104,7 +104,7 @@
offset) {
if ((type > XML_UDATA) || (type < 0) || (val < 0)) {
- throw new Exception("Tag and value must be positive, and tag valid.");
+ throw new Error("Tag and value must be positive, and tag valid.");
}
// Encode backwards. Calculate how many bytes we need:
@@ -112,7 +112,7 @@
var numEncodingBytes = numEncodingBytes(val);
if ((offset + numEncodingBytes) > buf.length) {
- throw new Exception("Buffer space of " + (buf.length-offset) +
+ throw new Error("Buffer space of " + (buf.length-offset) +
" bytes insufficient to hold " +
numEncodingBytes + " of encoded type and value.");
}
@@ -137,7 +137,7 @@
--i;
}
if (val != 0) {
- throw new Exception( "This should not happen: miscalculated encoding");
+ throw new Error( "This should not happen: miscalculated encoding");
//Log.warning(Log.FAC_ENCODING, "This should not happen: miscalculated encoding length, have " + val + " left.");
}
diff --git a/js/encoding/BinaryXMLDecoder.js b/js/encoding/BinaryXMLDecoder.js
index c41d549..41a4e45 100644
--- a/js/encoding/BinaryXMLDecoder.js
+++ b/js/encoding/BinaryXMLDecoder.js
@@ -86,7 +86,7 @@
tv = this.decodeTypeAndVal(this.istream);
if (null == tv) {
- throw new Exception("Expected start element: " + startTag + " got something not a tag.");
+ throw new Error("Expected start element: " + startTag + " got something not a tag.");
}
//String
@@ -101,7 +101,7 @@
}
if ((null == decodedTag) || decodedTag != startTag) {
- throw new Exception("Expected start element: " + startTag + " got: " + decodedTag + "(" + tv.val() + ")");
+ throw new Error("Expected start element: " + startTag + " got: " + decodedTag + "(" + tv.val() + ")");
}
if (null != attributes) {
@@ -109,7 +109,7 @@
}
} catch (e) {
- throw new Exception("readStartElement", e);
+ throw new Error("readStartElement", e);
}
};
@@ -189,7 +189,7 @@
tv = this.decodeTypeAndVal(this.istream);
if (null == tv) {
- throw new Exception("Expected start element: " + startTag + " got something not a tag.");
+ throw new Error("Expected start element: " + startTag + " got something not a tag.");
}
//String
@@ -227,7 +227,7 @@
if ((null == decodedTag) || decodedTag != startTag ) {
console.log('expecting '+ startag + ' but got '+ decodedTag);
- throw new Exception("Expected start element: " + startTag + " got: " + decodedTag + "(" + tv.val() + ")");
+ throw new Error("Expected start element: " + startTag + " got: " + decodedTag + "(" + tv.val() + ")");
}
// DKS: does not read attributes out of stream if caller doesn't
@@ -239,7 +239,7 @@
//} catch ( e) {
//console.log(e);
- //throw new Exception("readStartElement", e);
+ //throw new Error("readStartElement", e);
//}
}
@@ -281,7 +281,7 @@
// DKS TODO are attributes same or different dictionary?
attributeName = tagToString(thisTV.val());
if (null == attributeName) {
- throw new Exception("Unknown DATTR value" + thisTV.val());
+ throw new Error("Unknown DATTR value" + thisTV.val());
}
}
// Attribute values are always UDATA
@@ -296,7 +296,7 @@
} catch ( e) {
Log.logStackTrace(Log.FAC_ENCODING, Level.WARNING, e);
- throw new Exception("readStartElement", e);
+ throw new Error("readStartElement", e);
}
};
@@ -371,7 +371,7 @@
return false;
}
else{
- throw new Exception("SHOULD BE STRING OR NUMBER");
+ throw new Error("SHOULD BE STRING OR NUMBER");
}
}
//returns Long
@@ -425,7 +425,7 @@
this.offset = previousOffset;
} catch ( e) {
Log.logStackTrace(Log.FAC_ENCODING, Level.WARNING, e);
- throw new Exception("Cannot reset stream! " + e.getMessage(), e);
+ throw new Error("Cannot reset stream! " + e.getMessage(), e);
}
}
return decodedTag;
@@ -767,7 +767,7 @@
//}
//catch (e) {
- //throw new Exception("Cannot parse " + startTag + ": " + strVal);
+ //throw new Error("Cannot parse " + startTag + ": " + strVal);
//}
return parseInt(strVal);
diff --git a/js/encoding/BinaryXMLEncoder.js b/js/encoding/BinaryXMLEncoder.js
index 16759b1..7404802 100644
--- a/js/encoding/BinaryXMLEncoder.js
+++ b/js/encoding/BinaryXMLEncoder.js
@@ -207,14 +207,14 @@
if(LOG>4) console.log('OFFSET IS ' + this.offset );
if ((type > XML_UDATA) || (type < 0) || (val < 0)) {
- throw new Exception("Tag and value must be positive, and tag valid.");
+ throw new Error("Tag and value must be positive, and tag valid.");
}
// Encode backwards. Calculate how many bytes we need:
var numEncodingBytes = this.numEncodingBytes(val);
if ((this.offset + numEncodingBytes) > buf.length) {
- throw new Exception("Buffer space of " + (buf.length-this.offset) +
+ throw new Error("Buffer space of " + (buf.length-this.offset) +
" bytes insufficient to hold " +
numEncodingBytes + " of encoded type and value.");
}
@@ -239,7 +239,7 @@
--i;
}
if (val != 0) {
- throw new Exception( "This should not happen: miscalculated encoding");
+ throw new Error( "This should not happen: miscalculated encoding");
//Log.warning(Log.FAC_ENCODING, "This should not happen: miscalculated encoding length, have " + val + " left.");
}
this.offset+= numEncodingBytes;