Bug 1164713 - Return error string from FxAccounts. r=ferjm
authorAlexandre Lissy <lissyx@lissyx.dyndns.org>
Mon, 31 Aug 2015 07:54:00 -0400
changeset 260399 84e10095363e39a609813dfe638e5e3b44f5cc5f
parent 260398 758345e52ad67600049820aa3c7b1db1b3cc7282
child 260400 0c4641493674b4bebeb3fd824054b5e7cd945fcc
push id29309
push usercbook@mozilla.com
push dateWed, 02 Sep 2015 11:26:30 +0000
treeherdermozilla-central@f36760e83910 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersferjm
bugs1164713
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1164713 - Return error string from FxAccounts. r=ferjm
services/fxaccounts/FxAccountsManager.jsm
services/fxaccounts/tests/xpcshell/test_manager.js
--- a/services/fxaccounts/FxAccountsManager.jsm
+++ b/services/fxaccounts/FxAccountsManager.jsm
@@ -216,17 +216,17 @@ this.FxAccountsManager = {
               log.error("Signing out in response to server error threw: " +
                         reason);
               return this._error(reason);
             }
           );
         }
       );
     }
-    return Promise.reject(reason);
+    return Promise.reject(reason.message ? { error: reason.message } : reason);
   },
 
   _getAssertion: function(aAudience, aPrincipal) {
     return this._fxAccounts.getAssertion(aAudience).then(
       (result) => {
         if (aPrincipal) {
           this._addPermission(aPrincipal);
         }
--- a/services/fxaccounts/tests/xpcshell/test_manager.js
+++ b/services/fxaccounts/tests/xpcshell/test_manager.js
@@ -391,16 +391,17 @@ add_test(function() {
   certExpired = true;
   FxAccountsManager.getAssertion("audience", principal).then(
     result => {
       Services.io.offline = false;
       certExpired = false;
       do_throw("Unexpected success");
     },
     error => {
+      do_check_eq(error.error, ERROR_OFFLINE);
       FxAccountsManager._fxAccounts._reset();
       Services.io.offline = false;
       certExpired = false;
       run_next_test();
     }
   );
 });