Include response in HTTPError for invalid refresh token #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context:
The
requests.exceptions.HTTPError
exception has aresponse
attribute which normally stores the response to which that error pertains. When manually creating an instance ofrequests.exceptions.HTTPError
response
is an optional argument that one can pass to the constructor in order to populate this attribute. This attribute can be useful to find out more about why the response is considered to be an error. For example, a user may want to do the following:Description of the Change:
This change modifies the error handling in
Connection.update_refresh_token
to make sure that therequests.exceptions.HTTPError
that is raised when the refresh token is invalid has a validresponse
attribute.Benefits:
Consumers can check for things like the status code and error message when they catch an
HTTPError
that XCC threw. This can be useful if consuming code wants to check specifically for an invalid refresh token and have different behavior based on that specific error. It also prevents code that checks for the response from getting anAttributeError
when attempting to do so.Possible Drawbacks:
Related GitHub Issues: