mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-25 05:07:43 +00:00
don't be clever with server errors
This commit is contained in:
parent
b9e6950cb1
commit
203b6600d5
1 changed files with 1 additions and 10 deletions
|
@ -123,17 +123,8 @@ func (rac *AuthenticatedClient) request(r *Request, rh ResponseHandler, empty in
|
||||||
|
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
_ = rac.statsd.Incr("reddit.api.errors", r.tags, 0.1)
|
_ = rac.statsd.Incr("reddit.api.errors", r.tags, 0.1)
|
||||||
|
|
||||||
// Try to parse a json error. Otherwise we generate a generic one
|
|
||||||
parser := rac.pool.Get()
|
|
||||||
defer rac.pool.Put(parser)
|
|
||||||
|
|
||||||
val, jerr := parser.ParseBytes(bb)
|
|
||||||
if jerr != nil {
|
|
||||||
return nil, ServerError{resp.StatusCode}
|
return nil, ServerError{resp.StatusCode}
|
||||||
}
|
}
|
||||||
return nil, NewError(val, resp.StatusCode)
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.emptyResponseBytes > 0 && len(bb) == r.emptyResponseBytes {
|
if r.emptyResponseBytes > 0 && len(bb) == r.emptyResponseBytes {
|
||||||
return empty, nil
|
return empty, nil
|
||||||
|
|
Loading…
Reference in a new issue