Throw proper error when collection is moved into one of its descendents

This commit is contained in:
Dan Stillman 2018-06-26 21:06:11 +02:00
parent 3c1cdd57d2
commit f715c02a66

View file

@ -259,7 +259,7 @@ Zotero.Collection.prototype._initSave = Zotero.Promise.coroutine(function* (env)
}
if (this.id && this.hasDescendent('collection', newParent.id)) {
throw ('Cannot move collection "' + this.name + '" into one of its own descendents');
throw new Error(`Cannot move collection '${this.name}' into one of its own descendents`);
}
env.parent = newParent.id;