diff --git a/app/directives/external-account/external-account.directive.js b/app/directives/external-account/external-account.directive.js index 012e292cb..832a100d3 100644 --- a/app/directives/external-account/external-account.directive.js +++ b/app/directives/external-account/external-account.directive.js @@ -76,10 +76,13 @@ toaster.pop('error', "Whoops!", String.supplant( "This {provider} account is linked to another account. \ - If you think this is an error please contact support@apprio.com.", + If you think this is an error please contact support@topcoder.com.", {provider: provider.displayName } ) ); + } else { + $log.error("Fatal Error: _link: " + resp.msg); + toaster.pop('error', "Whoops!", "Sorry, we are unable to add your account right now. Please try again later. If the problem persists, please contact support@topcoder.com."); } }); } @@ -105,10 +108,10 @@ var msg = resp.msg; if (resp.status === 'SOCIAL_PROFILE_NOT_EXIST') { $log.info("Social profile not linked to account"); - msg = "{provider} account is not linked to your account. If you think this is an error please contact support@apprio.com."; + msg = "{provider} account is not linked to your account. If you think this is an error please contact support@topcoder.com."; } else { - $log.info("Fatal error: " + msg); - msg = "Sorry! We are unable to unlink your {provider} account. If problem persists, please contact support@apprio.com"; + $log.error("Fatal error: _unlink: " + msg); + msg = "Sorry! We are unable to unlink your {provider} account. If problem persists, please contact support@topcoder.com"; } toaster.pop('error', "Whoops!", String.supplant(msg, {provider: provider.displayName })); }); diff --git a/app/services/externalAccounts.service.js b/app/services/externalAccounts.service.js index ad82a9d3d..e99f71a76 100644 --- a/app/services/externalAccounts.service.js +++ b/app/services/externalAccounts.service.js @@ -58,12 +58,10 @@ }) .catch(function(resp) { $log.error("Error unlinking account: " + resp.data.result.content); - var status = resp.status; + var status = "FATAL_ERROR"; var msg = resp.data.result.content; - if (resp.status = 404) { + if (resp.status === 404) { status = "SOCIAL_PROFILE_NOT_EXIST"; - } else { - status = "FATAL_ERROR" } $reject({ status: status, @@ -113,9 +111,13 @@ }); }) .catch(function(resp) { + var errorStatus = "FATAL_ERROR"; $log.error("Error linking account: " + resp.data.result.content); + if (resp.data.result && resp.data.result.status === 400) { + errorStatus = "SOCIAL_PROFILE_ALREADY_EXISTS"; + } reject({ - status: "SOCIAL_PROFILE_ALREADY_EXISTS", + status: errorStatus, msg: resp.data.result.content }); });