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

Exceptions are irrecoverable when using get_resource(..., iterate=True) #11

Closed
bmwilly opened this issue Mar 14, 2018 · 1 comment
Closed

Comments

@bmwilly
Copy link
Contributor

bmwilly commented Mar 14, 2018

Since item_iterator returns an empty iterator when an exception is encountered, there is no way to recover the HTTP error that was raised:
image

This behavior is confusing and makes code difficult to debug. I think in this case, item_iterator should just raise the exception that occurs.

bmwilly added a commit to contiamo/api-python that referenced this issue Mar 14, 2018
If a request results in a non-200 status code, raise the exception
instead of returning a `requests.Response`.

Fixes usabilla#11
@bmwilly
Copy link
Contributor Author

bmwilly commented Mar 14, 2018

Going even further, I think a bad response should always be raised, instead of having send_signed_request sometimes return a dict and sometimes return a requests.Response with a bad status code. In my opinion, being explicit is better than silently returning bad Responses, None, or empty generators. My solution for this is at #12.

bmwilly added a commit to contiamo/api-python that referenced this issue Mar 14, 2018
If a request results in a non-200 status code, raise the exception
instead of returning a `requests.Response`.

Fixes usabilla#11
bmwilly added a commit to contiamo/api-python that referenced this issue Mar 15, 2018
If a request results in a non-200 status code, raise the exception
instead of returning a `requests.Response`.

Fixes usabilla#11
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

No branches or pull requests

1 participant