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