Catch revoke and throw nicer error

This commit is contained in:
Jay Lee
2022-10-05 17:09:39 +00:00
parent d185765831
commit c2bb9cbdaf

View File

@@ -482,7 +482,11 @@ class Credentials(google.oauth2.credentials.Credentials):
def _locked_refresh(self, request):
"""Refreshes the credential's access token while the file lock is held."""
assert self._lock.is_locked
super().refresh(request)
try:
super().refresh(request)
except google.auth.exceptions.RefreshError as e:
controlflow.system_error_exit(9, str(e))
def write(self):
"""Writes credentials to disk."""