From b4a7e90fe1fe04f54b10c8cb2445a0bd462e748b Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Tue, 12 Jan 2016 12:21:28 +1100 Subject: [PATCH] Bug 1236383 (part 2) - remove the now-unused 2nd param to checkServerError. r=kitcambridge --- services/sync/modules/policies.js | 4 ++-- services/sync/modules/service.js | 24 +++++++++++----------- services/sync/modules/stages/cluster.js | 4 ++-- services/sync/modules/stages/enginesync.js | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/services/sync/modules/policies.js b/services/sync/modules/policies.js index 2a89fc832e0..124cc3493d2 100644 --- a/services/sync/modules/policies.js +++ b/services/sync/modules/policies.js @@ -578,7 +578,7 @@ ErrorHandler.prototype = { let exception = subject; // exception thrown by engine's sync() method let engine_name = data; // engine name that threw the exception - this.checkServerError(exception, "engines/" + engine_name); + this.checkServerError(exception); Status.engines = [engine_name, exception.failureCode || ENGINE_UNKNOWN_FAIL]; this._log.debug(engine_name + " failed", exception); @@ -831,7 +831,7 @@ ErrorHandler.prototype = { * * This method also looks for "side-channel" warnings. */ - checkServerError: function (resp, cause) { + checkServerError: function (resp) { switch (resp.status) { case 200: case 404: diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 4aee45b8967..7f507be203c 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -539,12 +539,12 @@ Sync11Service.prototype = { try { info = this.resource(infoURL).get(); } catch (ex) { - this.errorHandler.checkServerError(ex, "info/collections"); + this.errorHandler.checkServerError(ex); throw ex; } // Always check for errors; this is also where we look for X-Weave-Alert. - this.errorHandler.checkServerError(info, "info/collections"); + this.errorHandler.checkServerError(info); if (!info.success) { throw "Aborting sync: failed to get collections."; } @@ -582,7 +582,7 @@ Sync11Service.prototype = { if (infoResponse.status != 200) { this._log.warn("info/collections returned non-200 response. Failing key fetch."); this.status.login = LOGIN_FAILED_SERVER_ERROR; - this.errorHandler.checkServerError(infoResponse, "info/collections"); + this.errorHandler.checkServerError(infoResponse); return false; } @@ -616,7 +616,7 @@ Sync11Service.prototype = { else { // Some other problem. this.status.login = LOGIN_FAILED_SERVER_ERROR; - this.errorHandler.checkServerError(cryptoResp, "crypto/keys"); + this.errorHandler.checkServerError(cryptoResp); this._log.warn("Got status " + cryptoResp.status + " fetching crypto keys."); return false; } @@ -664,7 +664,7 @@ Sync11Service.prototype = { } catch (ex) { // This means no keys are present, or there's a network error. this._log.debug("Failed to fetch and verify keys", ex); - this.errorHandler.checkServerError(ex, "crypto/keys"); + this.errorHandler.checkServerError(ex); return false; } }, @@ -752,14 +752,14 @@ Sync11Service.prototype = { default: // Server didn't respond with something that we expected this.status.login = LOGIN_FAILED_SERVER_ERROR; - this.errorHandler.checkServerError(test, "info/collections"); + this.errorHandler.checkServerError(test); return false; } } catch (ex) { // Must have failed on some network issue this._log.debug("verifyLogin failed", ex); this.status.login = LOGIN_FAILED_NETWORK_ERROR; - this.errorHandler.checkServerError(ex, "info/collections"); + this.errorHandler.checkServerError(ex); return false; } }, @@ -774,7 +774,7 @@ Sync11Service.prototype = { let uploadRes = wbo.upload(this.resource(this.cryptoKeysURL)); if (uploadRes.status != 200) { this._log.warn("Got status " + uploadRes.status + " uploading new keys. What to do? Throw!"); - this.errorHandler.checkServerError(uploadRes, "crypto/keys"); + this.errorHandler.checkServerError(uploadRes); throw new Error("Unable to upload symmetric keys."); } this._log.info("Got status " + uploadRes.status + " uploading keys."); @@ -1078,7 +1078,7 @@ Sync11Service.prototype = { // should be able to get the existing meta after we get a new node. if (this.recordManager.response.status == 401) { this._log.debug("Fetching meta/global record on the server returned 401."); - this.errorHandler.checkServerError(this.recordManager.response, "meta/global"); + this.errorHandler.checkServerError(this.recordManager.response); return false; } @@ -1095,7 +1095,7 @@ Sync11Service.prototype = { let uploadRes = newMeta.upload(this.resource(this.metaURL)); if (!uploadRes.success) { this._log.warn("Unable to upload new meta/global. Failing remote setup."); - this.errorHandler.checkServerError(uploadRes, "meta/global"); + this.errorHandler.checkServerError(uploadRes); return false; } } else { @@ -1126,7 +1126,7 @@ Sync11Service.prototype = { let status = this.recordManager.response.status; if (status != 200 && status != 404) { this.status.sync = METARECORD_DOWNLOAD_FAIL; - this.errorHandler.checkServerError(this.recordManager.response, "meta/global"); + this.errorHandler.checkServerError(this.recordManager.response); this._log.warn("Unknown error while downloading metadata record. " + "Aborting sync."); return false; @@ -1601,7 +1601,7 @@ Sync11Service.prototype = { // Make sure the changed clients get updated. this.clientsEngine.sync(); } catch (ex) { - this.errorHandler.checkServerError(ex, "clients"); + this.errorHandler.checkServerError(ex); throw ex; } }, diff --git a/services/sync/modules/stages/cluster.js b/services/sync/modules/stages/cluster.js index bbbe9f74bab..41afe61d8d4 100644 --- a/services/sync/modules/stages/cluster.js +++ b/services/sync/modules/stages/cluster.js @@ -56,14 +56,14 @@ ClusterManager.prototype = { this._log.trace("_findCluster successfully returning " + node); return node; default: - this.service.errorHandler.checkServerError(node, "node/weave"); + this.service.errorHandler.checkServerError(node); fail = "Unexpected response code: " + node.status; break; } } catch (e) { this._log.debug("Network error on findCluster"); this.service.status.login = LOGIN_FAILED_NETWORK_ERROR; - this.service.errorHandler.checkServerError(e, "node/weave"); + this.service.errorHandler.checkServerError(e); fail = e; } throw fail; diff --git a/services/sync/modules/stages/enginesync.js b/services/sync/modules/stages/enginesync.js index f0ce2a4ae13..d8f44396712 100644 --- a/services/sync/modules/stages/enginesync.js +++ b/services/sync/modules/stages/enginesync.js @@ -143,7 +143,7 @@ EngineSynchronizer.prototype = { this._updateEnabledEngines(); } catch (ex) { this._log.debug("Updating enabled engines failed", ex); - this.service.errorHandler.checkServerError(ex, "meta/global"); + this.service.errorHandler.checkServerError(ex); this.onComplete(ex); return; }