Skip to content

Commit

Permalink
chore: include api error info in raised errors (#699)
Browse files Browse the repository at this point in the history
* chore: include api error info in raised errors

* format strings
  • Loading branch information
Linchin committed Nov 17, 2023
1 parent 4051266 commit d921106
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pandas_gbq/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,15 @@ def run_query(self, query, max_results=None, progress_bar_type=None, **kwargs):
project=self.project_id,
)
logger.debug("Query running...")
except (RefreshError, ValueError):
except (RefreshError, ValueError) as ex:
if self.private_key:
raise AccessDenied("The service account credentials are not valid")
raise AccessDenied(
f"The service account credentials are not valid: {ex}"
)
else:
raise AccessDenied(
"The credentials have been revoked or expired, "
"please re-run the application to re-authorize"
f"please re-run the application to re-authorize: {ex}"
)
except self.http_error as ex:
self.process_http_error(ex)
Expand Down

0 comments on commit d921106

Please sign in to comment.