gist icon indicating copy to clipboard operation
gist copied to clipboard

Informative errors

Open jdowner opened this issue 10 years ago • 3 comments

Currently if there is a problem with the request to github, the reported error is cryptic because the code assumes success. Check responses and provide a message to help the user understand what the problem is.

jdowner avatar Feb 20 '15 14:02 jdowner

Hi,

Do you just want to check the HTTP status codes using something like http://docs.python-requests.org/en/latest/user/quickstart/#response-status-codes

Adding a Response.raise_for_status() in GistAPI.send() is one way I can think of solving this.

karanparikh avatar Feb 26 '15 06:02 karanparikh

Yes, it is going to involve checking the returned status. However, raise_for_status is not really the way to go. The idea should be to isolate the caller from the particular transport mechanism used (in this case HTTP) and give them information that is semantically meaningful. So the status codes need to be checked from within GistAPI and appropriate exceptions raised.

jdowner avatar Feb 26 '15 11:02 jdowner

An example of where this is an issue is when the token is invalid and the response is something like, 1450282075.615 ERROR[gist] string indices must be integers

jdowner avatar Dec 16 '15 16:12 jdowner