Skip to content

Conversation

@naveen-soho
Copy link
Contributor

@naveen-soho naveen-soho commented Sep 5, 2022

What/Why?

Added missing/uncaught OAuth errors logs and issues like JS-1029 can be identified at an earlier stage

Copy link

@davehwly davehwly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fill in PR template with what & why


if (!isAuthenticated || !!accessToken) return
if (!isAuthenticated || !!accessToken) {
errorLog('Not authenticate but access token exists.')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can't tell if a token exists from this lazy evaluation can you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but i think we can just say "not authenticated"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we adding nuxt-oauth - prefix to all the logs?

} else {
errorLog("nuxt-oauth - session token not found")
return {}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we remove the nesting would that improve readability?

if (!token) errorLog("nuxt-oauth - session token not found")
return token || {}

await this.saveData({ accessToken: existingToken })
}
} catch (e) {
errorLog("nuxt-oauth - saveData failed, clear the session")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would logging the error also be helpful here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think @naveen-soho we need to make sure these errorLogs are actually error situations. so they should be instances where we're throwing or catching errors and also making sure the errors are logged too

so for example if they don't have an accessToken, is that a situation that should never occur? incase we need an errorLog. If it could reasonably occur normally we don't need to log

we want to make sure abnormal situations are logged and captured in raygun etc


if (!isAuthenticated || !!accessToken) return
if (!isAuthenticated || !!accessToken) {
errorLog('Not authenticate but access token exists.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we adding nuxt-oauth - prefix to all the logs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants