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

HTTP error codes are swallowed #8

Open
naegelejd opened this issue May 1, 2015 · 3 comments
Open

HTTP error codes are swallowed #8

naegelejd opened this issue May 1, 2015 · 3 comments

Comments

@naegelejd
Copy link
Owner

As of now, if there is an HTTP error during a request, the error code is caught and swallowed and a very useless message is returned in its place.

Google's Github Go API actually returns an entire Response object for each endpoint, along with the result "object" and an error. This makes sense, but I don't know that it's not overkill. Regardless, something must be done.

@naegelejd
Copy link
Owner Author

Since 9ed4ce1 the error returned on a failed request is either from the net/http package or a string containing: "HTTP Error %d" % resp.StatusCode. It would probably be more useful if the error for non-2XX responses was an object containing the numerical HTTP status code.

@MovingtoMars
Copy link
Contributor

I actually like the Github way, it gives the user a lot of information.

@naegelejd
Copy link
Owner Author

I like it too. Let me think about what else should/could change if we do this. This would make all the "List" functions a little nicer, e.g. ListBeers could return ([]Beer, Response, error) and the Response object contains the information for pagination, and we could eliminate the BeerList type.

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

2 participants