A couple better error messages

This commit is contained in:
Dan Stillman 2016-02-04 03:50:48 -05:00
parent 72c927c840
commit 1855b5e1f9
2 changed files with 5 additions and 1 deletions

View File

@ -1227,6 +1227,10 @@ Zotero.DataObject.prototype.toResponseJSON = Zotero.Promise.coroutine(function*
Zotero.DataObject.prototype._preToJSON = function (options) {
if (!this._id) {
throw new Error(`${this._ObjectType} must be saved before running toJSON()`);
}
var env = { options };
env.mode = options.mode || 'new';
if (env.mode == 'patch') {

View File

@ -4000,7 +4000,7 @@ Zotero.Item.prototype.loadItemData = Zotero.Promise.coroutine(function* (reload)
Zotero.debug("Loading item data for item " + this.libraryKey);
if (!this.id) {
throw ('ItemID not set for object before attempting to load data');
throw new Error('ItemID not set for object before attempting to load data');
}
if (!this.isNote()) {