Skip to content

Commit

Permalink
fix(utilities): only throw error if error is not instance of `Inv…
Browse files Browse the repository at this point in the history
…alidTokenError`
  • Loading branch information
JoaoPedroAS51 authored and pi0 committed Mar 15, 2020
1 parent 84b3a33 commit 06af6e8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/core/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ export class TokenExpirationStatus {
tokenExpiration = decodedToken.exp * 1000
} catch (error) {
// If the token is not jwt, we can't decode and refresh it, use _tokenExpiresAt value
if (error instanceof InvalidTokenError) {
tokenExpiration = _tokenExpiresAt || false
}
tokenExpiration = _tokenExpiresAt || false

throw error
if (!(error instanceof InvalidTokenError)) {
throw error
}
}

// Set token expiration
Expand All @@ -197,11 +197,11 @@ export class TokenExpirationStatus {
refreshTokenExpiration = decodedToken.exp * 1000
} catch (error) {
// If the token is not jwt, we can't decode and refresh it, use _tokenExpiresAt value
if (error instanceof InvalidTokenError) {
refreshTokenExpiration = _tokenExpiresAt || false
}
refreshTokenExpiration = _tokenExpiresAt || false

throw error
if (!(error instanceof InvalidTokenError)) {
throw error
}
}

// Set token expiration
Expand Down

0 comments on commit 06af6e8

Please sign in to comment.