Add catches around calls to external services that might break login

This commit is contained in:
Joseph Schorr 2016-05-16 15:54:52 -04:00
parent dc95f36f66
commit 486facedbe

View file

@ -37,32 +37,44 @@ function(ApiService, CookieService, $rootScope, Config) {
if (!userResponse.anonymous) { if (!userResponse.anonymous) {
if (Config.MIXPANEL_KEY) { if (Config.MIXPANEL_KEY) {
mixpanel.identify(userResponse.username); try {
mixpanel.people.set({ mixpanel.identify(userResponse.username);
'$email': userResponse.email, mixpanel.people.set({
'$username': userResponse.username, '$email': userResponse.email,
'verified': userResponse.verified '$username': userResponse.username,
}); 'verified': userResponse.verified
mixpanel.people.set_once({ });
'$created': new Date() mixpanel.people.set_once({
}) '$created': new Date()
})
} catch (e) {
window.console.log(e);
}
} }
if (window.olark !== undefined) { if (window.olark !== undefined) {
olark('api.visitor.getDetails', function(details) { try {
if (details.fullName === null) { olark('api.visitor.getDetails', function(details) {
olark('api.visitor.updateFullName', {fullName: userResponse.username}); if (details.fullName === null) {
} olark('api.visitor.updateFullName', {fullName: userResponse.username});
}); }
olark('api.visitor.updateEmailAddress', {emailAddress: userResponse.email}); });
olark('api.chat.updateVisitorStatus', {snippet: 'username: ' + userResponse.username}); olark('api.visitor.updateEmailAddress', {emailAddress: userResponse.email});
olark('api.chat.updateVisitorStatus', {snippet: 'username: ' + userResponse.username});
} catch (e) {
window.console.log(e);
}
} }
if (window.Raven !== undefined) { if (window.Raven !== undefined) {
Raven.setUser({ try {
email: userResponse.email, Raven.setUser({
id: userResponse.username email: userResponse.email,
}); id: userResponse.username
});
} catch (e) {
window.console.log(e);
}
} }
CookieService.putPermanent('quay.loggedin', 'true'); CookieService.putPermanent('quay.loggedin', 'true');