-
-
Notifications
You must be signed in to change notification settings - Fork 425
Check response status code and raise if it is an error #491
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
Check response status code and raise if it is an error #491
Conversation
astroquery/utils/commons.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can just be response.raise_for_status(), you don't need the if statement or anything. At least, I thought that's what raise_for_status was supposed to do (raise an exception if status is bad, else pass)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keflavich - indeed, it works like that. Thanks.
|
Yes, I think this is a good idea. |
|
@keflavich - Addresed your comment. Does it need a changlog entry? |
|
Sure, call it a bugfix: this should have been the behavior all along. |
|
It looks like the |
|
Fixed. It's a wonder how it passed locally before I opened the PR. |
Check response status code and raise if it is an error
Would it make sense to check the response status for a query? If a client/server error is returned, it may be useful to raise an exception rather than return it as a valid result.