-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
@msarahan Also looking for better wording, or better way to raise error |
conda/cli/install.py
Outdated
specs.extend(common.specs_from_url(fpath, json=context.json)) | ||
try: | ||
specs.extend(common.specs_from_url(fpath, json=context.json)) | ||
except: |
There was a problem hiding this comment.
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.
conda/cli/install.py
Outdated
try: | ||
specs.extend(common.specs_from_url(fpath, json=context.json)) | ||
except: | ||
raise CondaError("Error parsing file, likely due to invalid file format") |
There was a problem hiding this comment.
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.
Thanks for putting this together @matta9001. I can confirm that the CLA was signed. Merging. |
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. |
closes #6696