From 67abbc8c4ad2e8ac944e2d0808a71b52a7d67d41 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 7 May 2015 17:10:13 -0400 Subject: [PATCH] Add errorHandler option to DataObject.prototype.save() This allows calling code to do something other than call Zotero.debug() on errors (like, say, nothing, in order to avoid logging certain expected errors) before throwing. --- chrome/content/zotero/xpcom/data/dataObject.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js index bebcb6e2a2..62086082cc 100644 --- a/chrome/content/zotero/xpcom/data/dataObject.js +++ b/chrome/content/zotero/xpcom/data/dataObject.js @@ -584,9 +584,10 @@ Zotero.DataObject.prototype.save = Zotero.Promise.coroutine(function* (options) Zotero.debug(e2, 1); }) .then(function() { - // Don't log expected errors - if (e.name != 'ZoteroUnknownFieldError' - && e.name != 'ZoteroMissingObjectError') { + if (options.errorHandler(e)) { + options.errorHandler(e); + } + else { Zotero.debug(e, 1); } throw e;