Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 27c08db

Browse files
committed
Merge pull request #526 from appirio-tech/feature/sup-2311-error-handling-ext-acc-link-unlink
SUP-2311, Add generic error message when something fails while linking/unlinking the external account
2 parents bbbf82c + 6cc8a22 commit 27c08db

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

app/directives/external-account/external-account.directive.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,13 @@
7676
toaster.pop('error', "Whoops!",
7777
String.supplant(
7878
"This {provider} account is linked to another account. \
79-
If you think this is an error please contact <a href=\"mailTo:support@.appirio.com\">support@apprio.com</a>.",
79+
If you think this is an error please contact <a href=\"mailTo:support@topcoder.com\">support@topcoder.com</a>.",
8080
{provider: provider.displayName }
8181
)
8282
);
83+
} else {
84+
$log.error("Fatal Error: _link: " + resp.msg);
85+
toaster.pop('error', "Whoops!", "Sorry, we are unable to add your account right now. Please try again later. If the problem persists, please contact <a href=\"mailTo:[email protected]\">[email protected]</a>.");
8386
}
8487
});
8588
}
@@ -105,10 +108,10 @@
105108
var msg = resp.msg;
106109
if (resp.status === 'SOCIAL_PROFILE_NOT_EXIST') {
107110
$log.info("Social profile not linked to account");
108-
msg = "{provider} account is not linked to your account. If you think this is an error please contact <a href=\"mailTo:support@.appirio.com\">support@apprio.com</a>.";
111+
msg = "{provider} account is not linked to your account. If you think this is an error please contact <a href=\"mailTo:support@topcoder.com\">support@topcoder.com</a>.";
109112
} else {
110-
$log.info("Fatal error: " + msg);
111-
msg = "Sorry! We are unable to unlink your {provider} account. If problem persists, please contact <a href=\"mailTo:support@.appirio.com\">support@apprio.com</a>";
113+
$log.error("Fatal error: _unlink: " + msg);
114+
msg = "Sorry! We are unable to unlink your {provider} account. If problem persists, please contact <a href=\"mailTo:support@topcoder.com\">support@topcoder.com</a>";
112115
}
113116
toaster.pop('error', "Whoops!", String.supplant(msg, {provider: provider.displayName }));
114117
});

app/services/externalAccounts.service.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,10 @@
5858
})
5959
.catch(function(resp) {
6060
$log.error("Error unlinking account: " + resp.data.result.content);
61-
var status = resp.status;
61+
var status = "FATAL_ERROR";
6262
var msg = resp.data.result.content;
63-
if (resp.status = 404) {
63+
if (resp.status === 404) {
6464
status = "SOCIAL_PROFILE_NOT_EXIST";
65-
} else {
66-
status = "FATAL_ERROR"
6765
}
6866
$reject({
6967
status: status,
@@ -113,9 +111,13 @@
113111
});
114112
})
115113
.catch(function(resp) {
114+
var errorStatus = "FATAL_ERROR";
116115
$log.error("Error linking account: " + resp.data.result.content);
116+
if (resp.data.result && resp.data.result.status === 400) {
117+
errorStatus = "SOCIAL_PROFILE_ALREADY_EXISTS";
118+
}
117119
reject({
118-
status: "SOCIAL_PROFILE_ALREADY_EXISTS",
120+
status: errorStatus,
119121
msg: resp.data.result.content
120122
});
121123
});

0 commit comments

Comments
 (0)