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

Fix #4. Detect HTTP RESPONSES different than 200 on Cursor objects #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pitbulk
Copy link
Contributor

@pitbulk pitbulk commented Jul 7, 2018

See #4

@pitbulk
Copy link
Contributor Author

pitbulk commented Jul 7, 2018

@richet what do you think? Is there a more elegant way to manage this?

TODO: Add documentation

else
results
@error = response.code.to_s
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesnt actually work. If you run this branch in the console using some Auth Only credentials you would expect it to produce a 401 error but in reality it just returns nil.

e.g. Run the sdk console

> bin/console
client = OneLogin::Api::Client.new(
  client_id: 'xxx',
  client_secret:'xxx',
  region: 'us'
)

users = client.get_users
# returns the cursor but no error yet as the users not fetched until each is called

users = client.get_users.each{|u|u.id}
# returns nil and since the error is applied to the cursor and not the client it is not visible 

@pitbulk
Copy link
Contributor Author

pitbulk commented Jul 11, 2018

The master branch return no error on client too.

My patch at provides error on the cursor object but I dont know how to propagate the error to the client.

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.

None yet

2 participants