Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set on_giveup in backoff to reraise Exception #2

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tap_google_analytics/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,16 @@ def generate_report_definition(self, stream):

return report_definition

# by default, program should re-raise exceptions on giveup,
# or else program ends with code 0 when it failed
def on_giveup_handler(details):
raise Exception(f"Gave up! Details: {details}")

@backoff.on_exception(backoff.expo,
(HttpError, socket.timeout),
max_tries=10,
giveup=is_fatal_error)
giveup=is_fatal_error,
on_giveup=on_giveup_handler)
def query_api(self, start_date, end_date, report_definition, pageToken=None, segment_id=None):
"""Queries the Analytics Reporting API V4.

Expand Down