From fc058011f1e5ad3c555925a3335c8562397f1f2c Mon Sep 17 00:00:00 2001 From: Brendan Abolivier Date: Fri, 25 Aug 2017 17:24:06 +0100 Subject: [PATCH] Handle non-OK status codes on lookup --- .../clientapi/thirdpartyinvites/thirdpartyinvites.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/thirdpartyinvites/thirdpartyinvites.go b/src/github.com/matrix-org/dendrite/clientapi/thirdpartyinvites/thirdpartyinvites.go index 371a3af6f..2d4f56c18 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/thirdpartyinvites/thirdpartyinvites.go +++ b/src/github.com/matrix-org/dendrite/clientapi/thirdpartyinvites/thirdpartyinvites.go @@ -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