Throw a proper error if item.relations isn't an object
This commit is contained in:
parent
39a2445d74
commit
677b2edd51
1 changed files with 4 additions and 0 deletions
|
@ -402,6 +402,10 @@ Zotero.DataObject.prototype.removeRelation = function (predicate, object) {
|
|||
Zotero.DataObject.prototype.setRelations = function (newRelations) {
|
||||
this._requireData('relations');
|
||||
|
||||
if (typeof newRelations != 'object') {
|
||||
throw new Error(`Relations must be an object (${typeof newRelations} given)`);
|
||||
}
|
||||
|
||||
var oldRelations = this._relations;
|
||||
|
||||
// Limit predicates to letters and colons for now
|
||||
|
|
Loading…
Reference in a new issue