From 9fe606afd277e2ece9202a1d1c80fe2305da467a Mon Sep 17 00:00:00 2001 From: fromkeith Date: Tue, 29 Mar 2016 21:16:43 -0600 Subject: [PATCH] Reject the correct deferred on error. The deferred was not being rejected when popup was being rejected. The 'return' statement looks misleading, as it is encapsulated inside a timeout, and thus nothing is actually being returned. --- satellizer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/satellizer.js b/satellizer.js index 9a832ed1..c5d42893 100644 --- a/satellizer.js +++ b/satellizer.js @@ -522,7 +522,7 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.ex openPopup = popup.open(url, defaults.name, defaults.popupOptions, defaults.redirectUri).pollPopup(defaults.redirectUri); } - return openPopup + openPopup .then(function(oauthData) { // When no server URL provided, return popup params as-is. // This is for a scenario when someone wishes to opt out from @@ -540,6 +540,8 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.ex } defer.resolve(Oauth2.exchangeForToken(oauthData, userData)); + }, function (err) { + defer.reject(err); }); });