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

Display better messages on legacy repo HTTP errors #2459

Conversation

dan-hipschman-od
Copy link

@dan-hipschman-od dan-hipschman-od commented May 24, 2020

Changes

This change gives a clear message to users when there's an error connecting to a private repo.

Current message:

$ export POETRY_HTTP_BASIC_PYPI_LOCAL_PASSWORD="incorrect-password"
$ poetry add private-package

[ValueError]
Could not find a matching version of package private-package

New message

  RepositoryError

  401 Client Error: Unauthorized for url: https://xyz.jfrog.io/xyz/api/pypi/pip/simple/private-package/

Notes:

  • This PR will supersede: Return a clear error when HTTP calls to legacy repo fail, instead of PackageNotFound #1072. This PR is similar but doesn't introduce a new dependency.
  • This will cause poetry to error out if it can't connect to a private repo, whereas currently it will ignore it. This seems better. However, there may be people who have an unused private repo configured, to which poetry can't connect. They'll start getting an error message. It should be an easy fix for them though.
  • There might also possibly be some private repos that return (non-404) errors for certain endpoints, and it's conceivable that some user actually depends on this. E.g., maybe their repo returns 400 for /pytest, and they depend on that so poetry continues on to try PyPI. This seems like it would be an issue with the repo, but I'm just thinking through all the possible cases.

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code. (seems unnecessary)

@finswimmer finswimmer requested a review from a team May 28, 2020
@finswimmer finswimmer added the area/error-handling Bad error messages/insufficient error handling label May 28, 2020
@dan-hipschman-od
Copy link
Author

dan-hipschman-od commented Jun 25, 2020

Does anyone have a few minutes to take a look at this? It's a pretty small change, and fixes an issue that has come up at my company a few times. Thanks so much! :)

@finswimmer finswimmer changed the base branch from develop to master Aug 15, 2020
Copy link
Member

@finswimmer finswimmer left a comment

Thanks a lot for your contribution 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/error-handling Bad error messages/insufficient error handling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants