Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make get_client_config() raise errors that are more meaningful to the user #115

Merged
merged 3 commits into from
Jan 14, 2025

Conversation

kgodlewski
Copy link
Contributor

A common case is where the user passes an invalid token, and is presented with a cryptic "unable to get client config".

@kgodlewski kgodlewski requested a review from PatrykGala January 9, 2025 14:03
if "X-Neptune-Api-Token" in error.message:
raise NeptuneInvalidCredentialsError()

raise_for_http_status(response.status_code)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unable to parse this suggestion, there seems to be a problem with indentation, and it looks like it's not replacing all the lines it should replace. Can you double check?

token_urls = TokenRefreshingURLs.from_dict(response.json())
response = get_client_config.sync_detailed(client=client)
if response.parsed is None:
raise NeptuneScaleError(message="Failed to initialize API client: invalid response from server")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a response status in the exception message

Copy link
Collaborator

@PatrykGala PatrykGala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a response status in the exception message

@kgodlewski kgodlewski force-pushed the kg/fix-get-client-config branch from f08d4a0 to 8fd053a Compare January 14, 2025 11:55
@kgodlewski kgodlewski requested a review from PatrykGala January 14, 2025 11:55
@kgodlewski kgodlewski merged commit 667d7e1 into main Jan 14, 2025
9 checks passed
@kgodlewski kgodlewski deleted the kg/fix-get-client-config branch January 14, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants