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

SUP-2311, Add generic error message when something fails while linking/unlinking the external account #526

Merged
merged 2 commits into from
Nov 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions app/directives/external-account/external-account.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href=\"mailTo:support@.appirio.com\">support@apprio.com</a>.",
If you think this is an error please contact <a href=\"mailTo:support@topcoder.com\">support@topcoder.com</a>.",
{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 <a href=\"mailTo:[email protected]\">[email protected]</a>.");
}
});
}
Expand All @@ -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 <a href=\"mailTo:support@.appirio.com\">support@apprio.com</a>.";
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>.";
} else {
$log.info("Fatal error: " + msg);
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>";
$log.error("Fatal error: _unlink: " + msg);
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>";
}
toaster.pop('error', "Whoops!", String.supplant(msg, {provider: provider.displayName }));
});
Expand Down
12 changes: 7 additions & 5 deletions app/services/externalAccounts.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
});
});
Expand Down