8000 Used try catch block to detect when parser fails to parse arguments by mannders00 · Pull Request #8328 · conda/conda · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Used try catch block to detect when parser fails to parse arguments #8328

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

Merged
merged 3 commits into from
Feb 23, 2019

Conversation

mannders00
Copy link
Contributor

closes #6696

@mannders00 mannders00 requested a review from a team as a code owner February 23, 2019 18:28
@mannders00
Copy link
Contributor Author

@msarahan Also looking for better wording, or better way to raise error

specs.extend(common.specs_from_url(fpath, json=context.json))
try:
specs.extend(common.specs_from_url(fpath, json=context.json))
except:
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to try to catch a specific kind of exception here. I don't know what exception(s) common.specs_from_url might raise, but you should be able to figure that out by looking at it, or by feeding it bad data and seeing what exception gets raised.

try:
specs.extend(common.specs_from_url(fpath, json=context.json))
except:
raise CondaError("Error parsing file, likely due to invalid file format")
Copy link
Contributor

Choose a reason for hiding this comment

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

This wording is fine, IMHO, but it would be good to add a link to what exactly constitutes a valid file (in the docs, ideally). A lot of the confusion that people have is around when it is a YAML file they should be using vs. some text file. Giving them pointers in the error message will be very helpful.

@jjhelmus
Copy link
Contributor

Thanks for putting this together @matta9001. I can confirm that the CLA was signed. Merging.

@jjhelmus jjhelmus merged commit ad31c75 into conda:master Feb 23, 2019
@mannders00 mannders00 deleted the parseFix branch February 23, 2019 21:24
@github-actions
Copy link

Hi there, thank you for your contribution to Conda!

This pull request has been automatically locked since it has not had recent activity after it was closed.

Please open a new issue or pull request if needed.

@github-actions github-actions bot added the locked [bot] locked due to inactivity label Aug 29, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

warn on incorrect use of conda install --file argument
3 participants
0