Add retry issue to GithubException, don't log it (#2611)

This commit is contained in:
Enrico Minack
2023-07-11 16:10:42 +02:00
committed by GitHub
parent 8bdfc3a0d7
commit de80ff4b91
2 changed files with 35 additions and 15 deletions
+22 -5
View File
@@ -112,7 +112,19 @@ class GithubRetry(Retry):
content = self.get_content(response, url)
content = json.loads(content)
message = content.get("message")
except Exception as e:
# we want to fall back to the actual github exception (probably a rate limit error)
# but provide some context why we could not deal with it without another exception
try:
raise RuntimeError(
"Failed to inspect response message"
) from e
except RuntimeError as e:
raise GithubException(
response.status, content, response.headers
) from e
try:
if Requester.isRateLimitError(message):
rate_type = (
"primary"
@@ -191,11 +203,16 @@ class GithubRetry(Retry):
except (MaxRetryError, GithubException):
raise
except Exception as e:
self.__log(
logging.WARNING,
"Failed to inspect response message",
exc_info=e,
)
# we want to fall back to the actual github exception (probably a rate limit error)
# but provide some context why we could not deal with it without another exception
try:
raise RuntimeError(
"Failed to determine retry backoff"
) from e
except RuntimeError as e:
raise GithubException(
response.status, content, response.headers
) from e
raise GithubException(response.status, content, response.headers)