From 38fa483091d52a34f7ae93c798fcf647374da794 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 10 Nov 2021 14:00:29 +0000 Subject: [PATCH] Tweak error handling --- federationsender/internal/perform.go | 6 +++--- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/federationsender/internal/perform.go b/federationsender/internal/perform.go index 4e1e9320..82ba85dd 100644 --- a/federationsender/internal/perform.go +++ b/federationsender/internal/perform.go @@ -116,11 +116,11 @@ func (r *FederationSenderInternalAPI) PerformJoin( // Clear the wrapped error, else serialising to JSON (in polylith mode) will fail httpErr.WrappedError = nil response.LastError = &httpErr - } else if na, ok := lastErr.(*gomatrixserverlib.NotAllowed); ok { + } else if errors.Is(lastErr, &gomatrixserverlib.NotAllowed{}) { response.LastError = &gomatrix.HTTPError{ Code: http.StatusForbidden, - WrappedError: na, - Message: na.Message, + WrappedError: lastErr, + Message: lastErr.Error(), } } else { response.LastError = &gomatrix.HTTPError{ diff --git a/go.mod b/go.mod index 2ddc0ec8..fa1a0fec 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/matrix-org/go-http-js-libp2p v0.0.0-20200518170932-783164aeeda4 github.com/matrix-org/go-sqlite3-js v0.0.0-20210709140738-b0d1ba599a6d github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16 - github.com/matrix-org/gomatrixserverlib v0.0.0-20211110113607-62a0f296c2bc + github.com/matrix-org/gomatrixserverlib v0.0.0-20211110135543-cb864482ffb9 github.com/matrix-org/naffka v0.0.0-20210623111924-14ff508b58e0 github.com/matrix-org/pinecone v0.0.0-20211022090602-08a50945ac89 github.com/matrix-org/util v0.0.0-20200807132607-55161520e1d4 diff --git a/go.sum b/go.sum index 42a3918b..54a93e50 100644 --- a/go.sum +++ b/go.sum @@ -993,8 +993,8 @@ github.com/matrix-org/go-sqlite3-js v0.0.0-20210709140738-b0d1ba599a6d/go.mod h1 github.com/matrix-org/gomatrix v0.0.0-20190528120928-7df988a63f26/go.mod h1:3fxX6gUjWyI/2Bt7J1OLhpCzOfO/bB3AiX0cJtEKud0= github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16 h1:ZtO5uywdd5dLDCud4r0r55eP4j9FuUNpl60Gmntcop4= github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s= -github.com/matrix-org/gomatrixserverlib v0.0.0-20211110113607-62a0f296c2bc h1:kWX34PjNl5btdk6WZJmWzda/8sDvUp40Owu8S3CjWnM= -github.com/matrix-org/gomatrixserverlib v0.0.0-20211110113607-62a0f296c2bc/go.mod h1:rB8tBUUUo1rzUqpzklRDSooxZ6YMhoaEPx4SO5fGeUc= +github.com/matrix-org/gomatrixserverlib v0.0.0-20211110135543-cb864482ffb9 h1:z7YjXsKQ9SocY8Pxfy1eq8zQgxoI6NdVOIQH7vfxIh0= +github.com/matrix-org/gomatrixserverlib v0.0.0-20211110135543-cb864482ffb9/go.mod h1:rB8tBUUUo1rzUqpzklRDSooxZ6YMhoaEPx4SO5fGeUc= github.com/matrix-org/naffka v0.0.0-20210623111924-14ff508b58e0 h1:HZCzy4oVzz55e+cOMiX/JtSF2UOY1evBl2raaE7ACcU= github.com/matrix-org/naffka v0.0.0-20210623111924-14ff508b58e0/go.mod h1:sjyPyRxKM5uw1nD2cJ6O2OxI6GOqyVBfNXqKjBZTBZE= github.com/matrix-org/pinecone v0.0.0-20211022090602-08a50945ac89 h1:6JkIymZ1vxfI0shSpg6gNPTJaF4/95Evy34slPVZGKM=