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
fixes #8549 - Fixes subscription error messages for act key, BZ 1154619 #4839
Conversation
@@ -213,6 +213,14 @@ def copy(new_name) | |||
new_key | |||
end | |||
|
|||
def subscribe(pool_id, quantity = 1) | |||
Resources::Candlepin::ActivationKey.add_pools self.cp_id, pool_id, quantity |
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.
Mind wrapping this args in parens?
def subscribe(pool_id, quantity = 1) | ||
Resources::Candlepin::ActivationKey.add_pools(self.cp_id, pool_id, quantity) | ||
rescue RestClient::ResourceNotFound, RestClient::BadRequest => e | ||
raise JSON.parse(e.response)['displayMessage'] |
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.
@daviddavis would fail
be better here?
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.
Negatory. raise
is the appropriate call since it's called inside a rescue.
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.
Here's Jim Weirich:
An aside, because I use exceptions to indicate failures, I almost always use the “fail” keyword rather than the “raise” keyword in Ruby. Fail and raise are synonyms so there is no difference except that “fail” more clearly communicates that the method has failed. The only time I use “raise” is when I am catching an exception and re-raising it, because here I’m not failing, but explicitly and purposefully raising an exception. This is a stylistic issue I follow, but I doubt many other people do.
ACK |
fixes #8549 - Fixes subscription error messages for act key, BZ 1154619
No description provided.