Fix the error msg

This commit is contained in:
Raymond Feng 2014-06-19 15:09:19 -07:00
parent 1833352238
commit 27f4c1b7b4
1 changed files with 2 additions and 11 deletions

View File

@ -13,7 +13,7 @@ function List(items, itemType, parent) {
try {
items = JSON.parse(items);
} catch (e) {
throw new Error('could not create List from JSON string: ', items);
throw new Error(util.format('could not create List from JSON string: %j', items));
}
}
@ -22,7 +22,7 @@ function List(items, itemType, parent) {
items = items || [];
if (!Array.isArray(items)) {
throw new Error('Items must be an array: ' + items);
throw new Error(util.format('Items must be an array: %j', items));
}
if(!itemType) {
@ -92,12 +92,3 @@ List.prototype.toString = function () {
return JSON.stringify(this.toJSON());
};
/*
var strArray = new List(['1', 2], String);
strArray.push(3);
console.log(strArray);
console.log(strArray.length);
console.log(strArray.toJSON());
console.log(strArray.toString());
*/