From e0f1e2a0338b8c3775480a22afa7962546131ce6 Mon Sep 17 00:00:00 2001 From: user Date: Tue, 7 Aug 2018 19:50:20 +0100 Subject: [PATCH] Do not warn when an AS room alias does not exist --- .../dendrite/appservice/query/query.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/appservice/query/query.go b/src/github.com/matrix-org/dendrite/appservice/query/query.go index 9dfb87a82..f15461dea 100644 --- a/src/github.com/matrix-org/dendrite/appservice/query/query.go +++ b/src/github.com/matrix-org/dendrite/appservice/query/query.go @@ -86,17 +86,20 @@ func (a *AppServiceQueryAPI) RoomAliasExists( log.WithError(err).Errorf("Issue querying room alias on application service %s", appservice.ID) return err } - if resp.StatusCode == http.StatusOK { - // StatusOK received from appservice. Room exists + switch resp.StatusCode { + case http.StatusOK: + // OK received from appservice. Room exists response.AliasExists = true return nil + case http.StatusNotFound: + // Room does not exist + default: + // Application service reported an error. Warn + log.WithFields(log.Fields{ + "appservice_id": appservice.ID, + "status_code": resp.StatusCode, + }).Warn("Application service responded with non-OK status code") } - - // Log non OK - log.WithFields(log.Fields{ - "appservice_id": appservice.ID, - "status_code": resp.StatusCode, - }).Warn("Application service responded with non-OK status code") } }