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

Reformat Ansible Tower error messages #14777

Merged
merged 1 commit into from
Apr 17, 2017

Conversation

bdunne
Copy link
Member

@bdunne bdunne commented Apr 17, 2017

Reformat error message for presentation purposes.
https://bugzilla.redhat.com/show_bug.cgi?id=1439135

After:
image

rescue AnsibleTowerClient::Error => err
message = JSON.parse(err.message) rescue nil
raise if message.nil?
raise message.values.flatten.join(", ")
Copy link
Member

Choose a reason for hiding this comment

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

If we do hit the inline rescue would this code not just re-raise that error, instead of the initial AnsibleTowerClient::Error that we really want to raise?

I think this is more what you want:

rescue AnsibleTowerClient::Error => err
  begin
    raise JSON.parse(err.message).values.flatten.join(", ")
  rescue JSON::ParserError
    raise err
  end
end

@bdunne bdunne force-pushed the create_in_provider_error_message branch from 92d58fa to 2f239dc Compare April 17, 2017 19:56
@miq-bot
Copy link
Member

miq-bot commented Apr 17, 2017

Checked commit bdunne@2f239dc with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks good. ⭐

@gmcculloug gmcculloug merged commit 33a9ed8 into ManageIQ:master Apr 17, 2017
@bdunne bdunne deleted the create_in_provider_error_message branch April 17, 2017 20:52
@bdunne bdunne added this to the Sprint 59 Ending Apr 24, 2017 milestone Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants