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
merged 19 commits into from Jun 25, 2019

Conversation

Projects
None yet
2 participants
@czoido
Copy link
Contributor

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:

This comment has been minimized.

Copy link
@memsharded

memsharded Jun 25, 2019

Contributor

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

@memsharded
Copy link
Contributor

left a comment

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

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

This comment has been minimized.

Copy link
@memsharded

memsharded Jun 25, 2019

Contributor

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

@memsharded

This comment has been minimized.

Copy link
Contributor

commented Jun 25, 2019

Check the broken test: https://conan-ci.jfrog.info/blue/organizations/jenkins/ConanTestSuite/detail/PR-5399/3/pipeline

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

continuous-integration/jenkins/pr-head This commit looks good
Details
license/cla Contributor License Agreement is signed.
Details

@memsharded memsharded self-assigned this Jun 25, 2019

@memsharded

This comment has been minimized.

Copy link
Contributor

commented Jun 25, 2019

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.