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{