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,6 +37,7 @@ function(ApiService, CookieService, $rootScope, Config) {
if (!userResponse.anonymous) { if (!userResponse.anonymous) {
if (Config.MIXPANEL_KEY) { if (Config.MIXPANEL_KEY) {
try {
mixpanel.identify(userResponse.username); mixpanel.identify(userResponse.username);
mixpanel.people.set({ mixpanel.people.set({
'$email': userResponse.email, '$email': userResponse.email,
@ -46,9 +47,13 @@ function(ApiService, CookieService, $rootScope, Config) {
mixpanel.people.set_once({ mixpanel.people.set_once({
'$created': new Date() '$created': new Date()
}) })
} catch (e) {
window.console.log(e);
}
} }
if (window.olark !== undefined) { if (window.olark !== undefined) {
try {
olark('api.visitor.getDetails', function(details) { olark('api.visitor.getDetails', function(details) {
if (details.fullName === null) { if (details.fullName === null) {
olark('api.visitor.updateFullName', {fullName: userResponse.username}); olark('api.visitor.updateFullName', {fullName: userResponse.username});
@ -56,13 +61,20 @@ function(ApiService, CookieService, $rootScope, Config) {
}); });
olark('api.visitor.updateEmailAddress', {emailAddress: userResponse.email}); olark('api.visitor.updateEmailAddress', {emailAddress: userResponse.email});
olark('api.chat.updateVisitorStatus', {snippet: 'username: ' + userResponse.username}); olark('api.chat.updateVisitorStatus', {snippet: 'username: ' + userResponse.username});
} catch (e) {
window.console.log(e);
}
} }
if (window.Raven !== undefined) { if (window.Raven !== undefined) {
try {
Raven.setUser({ Raven.setUser({
email: userResponse.email, email: userResponse.email,
id: userResponse.username id: userResponse.username
}); });
} catch (e) {
window.console.log(e);
}
} }
CookieService.putPermanent('quay.loggedin', 'true'); CookieService.putPermanent('quay.loggedin', 'true');