Tweak error handling

This commit is contained in:
Neil Alexander 2021-11-10 14:00:29 +00:00
parent 2e9a727620
commit 38fa483091
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 6 additions and 6 deletions

View file

@ -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{

2
go.mod
View file

@ -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

4
go.sum
View file

@ -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=