1
0
mirror of synced 2025-12-25 02:09:19 -05:00

Source Github: rewrite source connection error messages (#30654)

Co-authored-by: Serhii Lazebnyi <53845333+lazebnyi@users.noreply.github.com>
This commit is contained in:
Arsen Losenko
2023-09-22 19:12:49 +03:00
committed by GitHub
parent b574fc6586
commit 599ab7cfcd
4 changed files with 10 additions and 4 deletions

View File

@@ -188,7 +188,9 @@ class SourceGithub(AbstractSource):
user_message = f'Organization name: "{org_name}" is unknown, "repository" config option should be updated'
elif "401 Client Error: Unauthorized for url" in message:
# 401 Client Error: Unauthorized for url: https://api.github.com/orgs/datarootsio/repos?per_page=100&sort=updated&direction=desc
user_message = "Bad credentials, re-authentication or access token renewal is required"
user_message = (
"Github credentials have expired or changed, please review your credentials and re-authenticate or renew your access token."
)
return user_message
def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, Any]:
@@ -196,7 +198,10 @@ class SourceGithub(AbstractSource):
authenticator = self._get_authenticator(config)
_, repositories = self._get_org_repositories(config=config, authenticator=authenticator)
if not repositories:
return False, "Invalid repositories. Valid examples: airbytehq/airbyte airbytehq/another-repo airbytehq/* airbytehq/airbyte"
return (
False,
"Some of the provided repositories couldn't be found. Please verify if every entered repository has a valid name and it matches the following format: airbytehq/airbyte airbytehq/another-repo airbytehq/* airbytehq/airbyte.",
)
return True, None
except Exception as e: