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

Commit 20978bf

Browse files
author
vikasrohit
committed
SUP-2311, Add generic error message when something fails while linking/unlinking the external account
-- Added generic error message when anything bad happens with link/unlink calls.
1 parent a84d71c commit 20978bf

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
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
}
@@ -107,7 +110,7 @@
107110
$log.info("Social profile not linked to account");
108111
msg = "{provider} account is not linked to your account. If you think this is an error please contact <a href=\"mailTo:[email protected]\">[email protected]</a>.";
109112
} else {
110-
$log.info("Fatal error: " + msg);
113+
$log.error("Fatal error: _unlink: " + msg);
111114
msg = "Sorry! We are unable to unlink your {provider} account. If problem persists, please contact <a href=\"mailTo:[email protected]\">[email protected]</a>";
112115
}
113116
toaster.pop('error', "Whoops!", String.supplant(msg, {provider: provider.displayName }));

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)