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

Raising exception on utils#find_api_key #37

Merged
merged 1 commit into from
Jun 22, 2015

Conversation

josericardo
Copy link
Contributor

NoCredentialsException is a ClickException, which is handled nicely by
click, displaying the error msg and returning an exit code != 0.

Fixes #32 and #34

@josericardo josericardo force-pushed the raise-no-credentials-exception branch from ff7a1a8 to 95b2ab3 Compare June 19, 2015 22:37
@pablohoffman
Copy link
Contributor

Why do we need the custom class?. Why not just raise ClickException with the error message?

@josericardo
Copy link
Contributor Author

As a rule, I try not to raise generic exceptions. I think the code gets a little more expressive (even if no one is handling it, yet). Should I remove it?

@pablohoffman
Copy link
Contributor

I don't think there's a need for a custom exception in this case, and I prefer to keep the code simpler without them.

@pablohoffman
Copy link
Contributor

The first need for a custom exception class would come when we need to raise the same exception from multiple places, and in that case the exception message ("Use 'shub login' or ...") should probably be in the class definition, not passed at exception creation.

@josericardo josericardo force-pushed the raise-no-credentials-exception branch from 95b2ab3 to fd6113c Compare June 22, 2015 16:45
Raising a ClickException, which is handled nicely by
click, displaying the error msg and returning an exit code != 0.
@josericardo josericardo force-pushed the raise-no-credentials-exception branch from fd6113c to 36e8a9f Compare June 22, 2015 16:46
@josericardo josericardo changed the title Raising NoCredentialsException on utils#find_api_key Raising exception on utils#find_api_key Jun 22, 2015
@josericardo
Copy link
Contributor Author

You're right. Updated :)

pablohoffman added a commit that referenced this pull request Jun 22, 2015
@pablohoffman pablohoffman merged commit c0c17e3 into master Jun 22, 2015
@josericardo josericardo deleted the raise-no-credentials-exception branch November 30, 2015 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants