commit 6d46b06617f4a943ea27bcb4cc526aedbfc4af46
parent 76a37b4f9beaefaf2bcda23754ce139ed460ca0c
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 29 Oct 2015 03:13:08 -0400
Better debugging/errors in Zotero.DataObjects
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/dataObjects.js b/chrome/content/zotero/xpcom/data/dataObjects.js
@@ -142,7 +142,11 @@ Zotero.DataObjects.prototype.getAsync = Zotero.Promise.coroutine(function* (ids,
var toReturn = [];
if (!ids) {
- throw new Error("No arguments provided to " + this._ZDO_Objects + ".get()");
+ throw new Error("No arguments provided");
+ }
+
+ if (options && typeof options != 'object') {
+ throw new Error(`'options' must be an object, ${typeof options} given`);
}
if (Array.isArray(ids)) {
@@ -388,8 +392,7 @@ Zotero.DataObjects.prototype.registerObject = function (obj) {
var libraryID = obj.libraryID;
var key = obj.key;
- Zotero.debug("Registering " + this._ZDO_object + " " + id
- + " as " + libraryID + "/" + key);
+ //Zotero.debug("Registering " + this._ZDO_object + " " + id + " as " + libraryID + "/" + key);
if (!this._objectIDs[libraryID]) {
this._objectIDs[libraryID] = {};
}
@@ -438,7 +441,7 @@ Zotero.DataObjects.prototype.unload = function () {
*/
Zotero.DataObjects.prototype.updateVersion = Zotero.Promise.method(function (ids, version) {
if (version != parseInt(version)) {
- throw new Error("'version' must be an integer");
+ throw new Error("'version' must be an integer ('" + version + "' given)");
}
version = parseInt(version);