Complain when constructing a Structure with an undefined field, not when manipulating such a structure later
This commit is contained in:
parent
8e7cf160d6
commit
084566b579
|
@ -73,6 +73,9 @@ function Structure(meta, fields) {
|
||||||
this.fields = fields.slice(0);
|
this.fields = fields.slice(0);
|
||||||
for (var i = 0; i < fields.length; i++) {
|
for (var i = 0; i < fields.length; i++) {
|
||||||
this[i] = fields[i] = Immutable.fromJS(fields[i]);
|
this[i] = fields[i] = Immutable.fromJS(fields[i]);
|
||||||
|
if (this[i] === void 0) {
|
||||||
|
throw new Error("Structure: cannot contain undefined value at field " + i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue