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

Handling error when reference not found using conan download #5399

merged 19 commits into from Jun 25, 2019


Copy link

@czoido czoido commented Jun 25, 2019

Changelog: Fix: Handling error when reference not found using conan download
Docs: Omit

Fixes: #5397

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

@czoido czoido requested a review from jgsogo Jun 25, 2019
@@ -74,6 +74,13 @@ def wrapper(*args, **kwargs):
with tools.environment_append(api._cache.config.env_vars):
# Patch the globals in tools
return f(*args, **kwargs)
except NotFoundException as exc:
Copy link

@memsharded memsharded Jun 25, 2019

Hi @czoido

I don't think this should be handled here, but much sooner. Here it is too late, and there are other things that could cause a NotFoundException (e.g. trying to download a .zip for the conan config install).

It is the exception itself who should encode a better error message as close to the raise as possible, by the one that has the context (remote_name, ref, or whatever makes sense)

@czoido czoido requested a review from memsharded Jun 25, 2019
Copy link

@memsharded memsharded left a comment

Much better. Please also add a test, or an extra check to an existing test, and it could be merged. Thanks!

ref = remote_manager.get_recipe(ref, remote)
except NotFoundException as exc:
if exc.args and "404" in exc.args[0]:
Copy link

@memsharded memsharded Jun 25, 2019

You can skip the check of 404, you already got that exception. It is ok to re-raise it with a new message.

Copy link

@memsharded memsharded commented Jun 25, 2019

Check the broken test:

Also, consider adding a new test or a new check in existing test for the download command behavior.

@memsharded memsharded added this to the 1.17 milestone Jun 25, 2019
@memsharded memsharded merged commit b6840cc into conan-io:develop Jun 25, 2019
2 checks passed
@memsharded memsharded self-assigned this Jun 25, 2019
Copy link

@memsharded memsharded commented Jun 25, 2019

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants