www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 1855b5e1f9a8e6b31e96c57a24dd1398dcf4dffe
parent 72c927c84082b526a2e784eccb54e3a0f6e09de4
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu,  4 Feb 2016 03:50:48 -0500

A couple better error messages

Diffstat:
Mchrome/content/zotero/xpcom/data/dataObject.js | 4++++
Mchrome/content/zotero/xpcom/data/item.js | 2+-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js @@ -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') { diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js @@ -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()) {