Handle non-OK status codes on lookup

This commit is contained in:
Brendan Abolivier 2017-08-25 17:24:06 +01:00
parent a61327eccd
commit fc058011f1
No known key found for this signature in database
GPG key ID: 8EF1500759F70623

View file

@ -194,7 +194,13 @@ func queryIDServerLookup(body *MembershipRequest) (res *idServerLookupResponse,
if err != nil {
return
}
// TODO: Check status code
if resp.StatusCode != http.StatusOK {
// TODO: Log the error supplied with the identity server?
errMgs := fmt.Sprintf("Failed to ask %s to store an invite for %s", body.IDServer, body.Address)
return nil, errors.New(errMgs)
}
res = new(idServerLookupResponse)
err = json.NewDecoder(resp.Body).Decode(res)
return