Skip to content

Commit

Permalink
Restricting HTTPError try/catch to only 20404 Twilio code errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Luishfs authored and Alex-Bair committed Aug 22, 2024
1 parent df3d7c0 commit 6dc5c82
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions source-twilio/source_twilio/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,13 @@ def read_records(
if record[self.cursor_field] >= self.state.get(self.cursor_field, self._start_date):
self._cursor_value = record[self.cursor_field]
yield record
except HTTPError:
except HTTPError as err:
# Catching errors similar to
# {"code": 20404, "message": "The requested resource /2010-04-01/Accounts/XXX/Usage/Records.json was not found"}
pass
if err.response.json()["code"] == 20404:
pass
else:
raise err


class TwilioNestedStream(TwilioStream):
Expand Down

0 comments on commit 6dc5c82

Please sign in to comment.