From c2bb9cbdafea66a5d5f851062216922da80822a1 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Wed, 5 Oct 2022 17:09:39 +0000 Subject: [PATCH] Catch revoke and throw nicer error --- src/gam/auth/oauth.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gam/auth/oauth.py b/src/gam/auth/oauth.py index a7add74a..df6cf9f8 100644 --- a/src/gam/auth/oauth.py +++ b/src/gam/auth/oauth.py @@ -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."""