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
retrieve proper message and reason when response can't be loaded to json #673
retrieve proper message and reason when response can't be loaded to json #673
Conversation
The requests documentation for the
But |
Oh, nice catch. I'll look into it. |
You should just return the text of the response if it can't be converted to JSON. Raw data is unlikely to be useful and I can't image a scenario where spotify returns data that can't be converted to a string. |
I see that that there is a |
|
Furthermore, the |
Here's a much simpler solution: Just change this line from msg = response.text |
Ok, just to make sure we are on the same page: the response has a |
The stack trace itself (notice how the
|
And instead of retrieving the |
Yes, precisely. The instance of The |
Notice that |
Now I get it. Thanks for the explanation 🙌 Now, how about:
Instead of:
in: To avoid an empty |
|
I couldn't reproduce the throwing of
BrokenPipeError
reported in #633, but noticed that theSpotifyException
that was being thrown instead hadNone
asreason
. I then noticed that bothmsg
andreason
could possibly be retrieved from the response'sraw
, so I created a method to do it (only if loading to json fails). I also extracted a method from the original code.