Throw error in Item::fromJSON() if itemType not provided and not set
This commit is contained in:
parent
e45aabd03c
commit
79733c75f1
|
@ -3802,6 +3802,10 @@ Zotero.Item.prototype.fromJSON = Zotero.Promise.coroutine(function* (json) {
|
||||||
yield this.loadAllData();
|
yield this.loadAllData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!json.itemType && !this._itemTypeID) {
|
||||||
|
throw new Error("itemType property not provided");
|
||||||
|
}
|
||||||
|
|
||||||
let itemTypeID = Zotero.ItemTypes.getID(json.itemType);
|
let itemTypeID = Zotero.ItemTypes.getID(json.itemType);
|
||||||
this.setType(itemTypeID);
|
this.setType(itemTypeID);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user