Skip to content

Commit

Permalink
bug/9119-Chika-NotLoggingVamaLoginTokenFetchErrors (#9222)
Browse files Browse the repository at this point in the history
  • Loading branch information
cadibemma authored Jul 30, 2024
1 parent 2789bc3 commit 445006d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
13 changes: 4 additions & 9 deletions VAMobile/src/constants/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,11 +567,6 @@ export const Events = {
},
}
},
vama_exchange_failed: (): Event => {
return {
name: 'vama_exchange_failed',
}
},
vama_fail: (): Event => {
return {
name: 'vama_fail',
Expand Down Expand Up @@ -745,11 +740,11 @@ export const Events = {
},
}
},
vama_login_token_fetch: (status_code: number): Event => {
vama_login_token_fetch: (error: Error): Event => {
return {
name: 'vama_login_token_fetch',
params: {
status_code,
error: JSON.stringify(error),
},
}
},
Expand All @@ -761,11 +756,11 @@ export const Events = {
},
}
},
vama_login_token_refresh: (status_code: number): Event => {
vama_login_token_refresh: (error: Error): Event => {
return {
name: 'vama_login_token_refresh',
params: {
status_code,
error: JSON.stringify(error),
},
}
},
Expand Down
11 changes: 3 additions & 8 deletions VAMobile/src/store/slices/authSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,16 +494,13 @@ export const attemptIntializeAuthWithRefreshToken = async (
if (isErrorObject(error)) {
console.error(error)
logNonFatalErrorToFirebase(error, `attemptIntializeAuthWithRefreshToken: ${authNonFatalErrorString}`)
if (error.status) {
await logAnalyticsEvent(Events.vama_login_token_refresh(error.status))
}
await logAnalyticsEvent(Events.vama_login_token_refresh(error))
}
// if some error occurs, we need to force them to re-login
// even if they had a refreshToken saved, since these tokens are one time use
// if we fail, we just need to get a new one (re-login) and start over
// TODO we can check to see if we get a specific error for this scenario (refresh token no longer valid) so we may avoid
// re-login in certain error situations
// await logAnalyticsEvent(Events.vama_exchange_failed())
await finishInitialize(dispatch, LOGIN_PROMPT_TYPE.LOGIN, false)
}
}
Expand Down Expand Up @@ -682,10 +679,8 @@ export const handleTokenCallbackUrl =
} catch (error) {
if (isErrorObject(error)) {
logNonFatalErrorToFirebase(error, `handleTokenCallbackUrl: ${authNonFatalErrorString}`)
await logAnalyticsEvent(Events.vama_exchange_failed())
if (error.status) {
await logAnalyticsEvent(Events.vama_login_token_fetch(error.status))
}
await logAnalyticsEvent(Events.vama_login_token_fetch(error))

dispatch(dispatchFinishAuthLogin({ error }))
}
}
Expand Down

0 comments on commit 445006d

Please sign in to comment.