Skip to content

Commit

Permalink
chore: Handle gh refresh attempt failure more gracefully (#53)
Browse files Browse the repository at this point in the history
Instead of throwing error we're gonna pretend like it didn't happen.
  • Loading branch information
giovanni-guidini committed Sep 29, 2023
1 parent a481123 commit a3479cd
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions shared/torngit/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,17 @@ async def refresh_token(
}
)
return self.token
# Not passing the response on purpose in case we are failing to parse it properly
# So as to not leak user's tokens by accident
raise TorngitRefreshTokenFailedError(dict(error="No access_token in response"))
# https://docs.github.com/apps/managing-oauth-apps/troubleshooting-oauth-app-access-token-request-errors
log.error(
dict(
error="No access_token in response",
gh_error=session.get("error"),
gh_error_description=session.get("error_description"),
)
)
# Retunring None will let the code handle the request failure gracefully
# Instead of probably throwing 500
return None

# Generic
# -------
Expand Down

0 comments on commit a3479cd

Please sign in to comment.