Only log exception in GitHub when something unexpected raised (#64974)

pull/64990/head
Joakim Sørensen 2022-01-26 18:11:40 +01:00 committed by GitHub
parent d14fbf40c8
commit f23277a187
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -6,8 +6,10 @@ from typing import Literal, TypedDict
from aiogithubapi import (
GitHubAPI,
GitHubCommitModel,
GitHubConnectionException,
GitHubException,
GitHubNotModifiedException,
GitHubRatelimitException,
GitHubReleaseModel,
GitHubRepositoryModel,
GitHubResponseModel,
@ -69,7 +71,11 @@ class GitHubBaseDataUpdateCoordinator(DataUpdateCoordinator[T]):
)
# Return the last known data if the request result was not modified
return self.data
except (GitHubConnectionException, GitHubRatelimitException) as exception:
# These are expected and we dont log anything extra
raise UpdateFailed(exception) from exception
except GitHubException as exception:
# These are unexpected and we log the trace to help with troubleshooting
LOGGER.exception(exception)
raise UpdateFailed(exception) from exception
else: