From 3639359323873256d4fde4c27de2cceec8844625 Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Thu, 5 Mar 2015 16:32:18 +1100 Subject: [PATCH] Bug 1128785 - ensureLoggedIn() failure is now always noticed by Sync. r=rnewman --- services/sync/modules/browserid_identity.js | 2 +- services/sync/modules/service.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/services/sync/modules/browserid_identity.js b/services/sync/modules/browserid_identity.js index f466c1710dd..ff14c94f514 100644 --- a/services/sync/modules/browserid_identity.js +++ b/services/sync/modules/browserid_identity.js @@ -144,7 +144,7 @@ this.BrowserIDManager.prototype = { // re-entering of credentials by the user is necessary we don't take any // further action - an observer will fire when the user does that. if (Weave.Status.login == LOGIN_FAILED_LOGIN_REJECTED) { - return Promise.reject(); + return Promise.reject(new Error("User needs to re-authenticate")); } // So - we've a previous auth problem and aren't currently attempting to diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 2deda869146..73719e0ced8 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -978,7 +978,10 @@ Sync11Service.prototype = { // Ask the identity manager to explicitly login now. let cb = Async.makeSpinningCallback(); - this.identity.ensureLoggedIn().then(cb, cb); + this.identity.ensureLoggedIn().then( + () => cb(null), + err => cb(err || "ensureLoggedIn failed") + ); // Just let any errors bubble up - they've more context than we do! cb.wait();