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

impersonate - raise error when non success response is returned #121

Merged
merged 1 commit into from
Apr 18, 2018

Conversation

bartes
Copy link
Contributor

@bartes bartes commented Apr 14, 2018

No description provided.

@bartes bartes force-pushed the impersonation_error branch from 589d826 to 375ca61 Compare April 14, 2018 08:00
@nijikon nijikon force-pushed the impersonation_error branch from 375ca61 to 4d9262a Compare April 17, 2018 08:27
@@ -81,7 +81,9 @@ def impersonate(options = {})
options = Castle::Utils.deep_symbolize_keys(options || {})
add_timestamp_if_necessary(options)
command = Castle::Commands::Impersonate.new(@context).build(options)
@api.request(command)
@api.request(command).tap do |response|
raise Castle::ApiError, 'Impersonate request failed' unless response[:success]
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be a custom error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mensfeld - corrected

@nijikon nijikon force-pushed the impersonation_error branch from d376e74 to 6b0007a Compare April 18, 2018 08:20
@@ -81,7 +81,9 @@ def impersonate(options = {})
options = Castle::Utils.deep_symbolize_keys(options || {})
add_timestamp_if_necessary(options)
command = Castle::Commands::Impersonate.new(@context).build(options)
@api.request(command)
@api.request(command).tap do |response|
raise Castle::ImpersonationFailed unless response[:success]
Copy link
Contributor

Choose a reason for hiding this comment

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

you could provide a context or some details as a raise argument, it will make debuggng easier.

@nijikon nijikon self-assigned this Apr 18, 2018
@nijikon nijikon merged commit 949eb9a into master Apr 18, 2018
@nijikon nijikon deleted the impersonation_error branch April 18, 2018 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants