Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

throw Error, not string

  • Loading branch information...
commit dfa51032dc8fad0a36cba7591decf59a43db2e52 1 parent 51a105e
bitmage authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 index.js
View
6 index.js
@@ -86,7 +86,7 @@ var EasyXml = function() {
if (typeof child === 'string' || typeof child === 'number') {
parentXmlNode.set(key.substring(1), child);
} else {
- throw("non_string_attribute");
+ throw new Error("non_string_attribute");
}
} else if (child === null) {
// Null data, send an empty tag
@@ -111,7 +111,7 @@ var EasyXml = function() {
// JavaScript date format
el.text = child.toString();
} else {
- throw("unknown_date_format");
+ throw new Error("unknown_date_format");
}
} else if (typeof child === 'object' && child.constructor && child.constructor.name && child.constructor.name === 'Array') {
// Array
@@ -140,7 +140,7 @@ var EasyXml = function() {
el = subElement(parentXmlNode, key);
el.text = child.toString();
} else {
- throw("unknown_data_type");
+ throw new Error("unknown_data_type");
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.