mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Add retry issue to GithubException, don't log it (#2611)
This commit is contained in:
+22
-5
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user