Throw invalid-data error on unknown attachment link mode in fromJSON()
This commit is contained in:
parent
e9473caa14
commit
4838726b87
1 changed files with 8 additions and 2 deletions
|
@ -2707,7 +2707,7 @@ Zotero.defineProperty(Zotero.Item.prototype, 'attachmentLinkMode', {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw ("Invalid attachment link mode '" + val
|
throw new Error("Invalid attachment link mode '" + val
|
||||||
+ "' in Zotero.Item.attachmentLinkMode setter");
|
+ "' in Zotero.Item.attachmentLinkMode setter");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4310,7 +4310,13 @@ Zotero.Item.prototype.fromJSON = function (json, options = {}) {
|
||||||
// Attachment metadata
|
// Attachment metadata
|
||||||
//
|
//
|
||||||
case 'linkMode':
|
case 'linkMode':
|
||||||
this.attachmentLinkMode = Zotero.Attachments["LINK_MODE_" + val.toUpperCase()];
|
let linkMode = Zotero.Attachments["LINK_MODE_" + val.toUpperCase()];
|
||||||
|
if (linkMode === undefined) {
|
||||||
|
let e = new Error(`Unknown attachment link mode '${val}'`);
|
||||||
|
e.name = "ZoteroInvalidDataError";
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
this.attachmentLinkMode = linkMode;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'contentType':
|
case 'contentType':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue