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