diff --git a/chrome/content/zotero/merge.js b/chrome/content/zotero/merge.js index f421f2ddf7..c3c68a9fd2 100644 --- a/chrome/content/zotero/merge.js +++ b/chrome/content/zotero/merge.js @@ -46,8 +46,9 @@ var Zotero_Merge_Window = new function () { break; default: - throw ("Unsupported merge object type '" + _mergeGroup.type + _error("Unsupported merge object type '" + _mergeGroup.type + "' in Zotero_Merge_Window.init()"); + return; } _mergeGroup.leftCaption = _io.dataIn.captions[0]; @@ -128,13 +129,8 @@ var Zotero_Merge_Window = new function () { } } catch (e) { - Zotero.debug(e); - - var prompt = Components.classes["@mozilla.org/network/default-prompt;1"] - .createInstance(Components.interfaces.nsIPrompt); - prompt.alert(Zotero.getString('general.error'), e); - _wizard.getButton('cancel').click(); - return false; + _error(e); + return; } if (_mergeGroup.type == 'item') { @@ -203,8 +199,9 @@ var Zotero_Merge_Window = new function () { // Hack to support creator reconciliation via item view function _updateChangedCreators() { if (_mergeGroup.type != 'item') { - throw ("_updateChangedCreators called on non-item object in " + _error("_updateChangedCreators called on non-item object in " + "Zotero_Merge_Window._updateChangedCreators()"); + return; } if (_io.dataIn.changedCreators) { @@ -228,4 +225,11 @@ var Zotero_Merge_Window = new function () { } } } + + + function _error(e) { + Zotero.debug(e); + _io.error = e; + _wizard.getButton('cancel').click(); + } } diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js index 8db0954153..4ced787f9f 100644 --- a/chrome/content/zotero/xpcom/sync.js +++ b/chrome/content/zotero/xpcom/sync.js @@ -144,10 +144,6 @@ Zotero.Sync = new function() { } // Last sync time is before start of log - Zotero.debug('=============='); - Zotero.debug(lastSyncDate); - Zotero.debug(lastSyncDate + ''); - Zotero.debug(syncLogStart); if (lastSyncDate && new Date(syncLogStart * 1000) > lastSyncDate) { return -1; } @@ -2668,9 +2664,8 @@ Zotero.Sync.Server.Data = new function() { var mergeData = _reconcile(type, toReconcile, remoteCreatorStore); if (!mergeData) { - // TODO: throw? Zotero.DB.rollbackTransaction(); - return false; + throw ("Merge error"); } _processMergeData( syncSession, @@ -3205,7 +3200,9 @@ Zotero.Sync.Server.Data = new function() { .getService(Components.interfaces.nsIWindowMediator); var lastWin = wm.getMostRecentWindow("navigator:browser"); lastWin.openDialog('chrome://zotero/content/merge.xul', '', 'chrome,modal,centerscreen', io); - + if (io.error) { + throw (io.error); + } return io.dataOut; }