google / google/webrisk

doRequest does not provide enough information when the response is not a 200

Open
#30 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
87
Forks
41
Avg merge
19d 17h
Merged PRs (30d)
1

Description

Google provides a reason why for some requests when they come back so it would be helpful to provide that response when debugging issues.

We have an issue right now that we can't figure out where after a few days weeks of our app running we start getting 403s from the api but all we get is

```
webrisk: 2023/01/11 21:01:51 database.go:218: ListUpdate failure (3882620): webrisk: unexpected server response code: 403
```

Which is not really useful at all and I've tracking it down to [line 96](https://github.com/google/webrisk/blob/master/api.go#L96) in `api.go`.

Maybe the return error could contain the body as a string or something until a more developed response error can be created?

I figure this isn't handled yet because the documentation doesn't provide a definition of the possible response bodies when it's not a 200 so without just breaking random parts of the request to see what the responses are it's impossible to know what some type of `ErrorResponse` would look like.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.