Skip to content

Commit

Permalink
Fix issue dbt-labs#4178
Browse files Browse the repository at this point in the history
Allow retries when the answer is None
  • Loading branch information
b-per committed Nov 8, 2021
1 parent dd84f9a commit b98fb7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/dbt/clients/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def _get(path, registry_base_url=None):
logger.debug('Response from registry: GET {} {}'.format(url,
resp.status_code))
resp.raise_for_status()
if resp is None:
raise requests.exceptions.InvalidJSONError('Request error: The response is None', response=resp)
return resp.json()


Expand Down
2 changes: 1 addition & 1 deletion core/dbt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def _connection_exception_retry(fn, max_attempts: int, attempt: int = 0):
"""
try:
return fn()
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as exc:
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout, requests.exceptions.InvalidJSONError) as exc:
if attempt <= max_attempts - 1:
logger.debug('Retrying external call. Attempt: ' +
f'{attempt} Max attempts: {max_attempts}')
Expand Down

0 comments on commit b98fb7f

Please sign in to comment.