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

fixes #8549 - Fixes subscription error messages for act key, BZ 1154619 #4839

Merged
merged 1 commit into from Dec 9, 2014

Conversation

cfouant
Copy link
Member

@cfouant cfouant commented Dec 2, 2014

No description provided.

@@ -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
Copy link
Member

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']
Copy link
Member

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?

Copy link
Contributor

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.

Copy link
Contributor

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.

@ehelms ehelms self-assigned this Dec 8, 2014
@ehelms
Copy link
Member

ehelms commented Dec 9, 2014

ACK

cfouant added a commit that referenced this pull request Dec 9, 2014
fixes #8549 - Fixes subscription error messages for act key, BZ 1154619
@cfouant cfouant merged commit c9a5171 into Katello:master Dec 9, 2014
@cfouant cfouant deleted the errors branch December 9, 2014 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants