From 51c642b8ad6b66fac3edc5523b2dd2cc1228aa51 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 14 Aug 2020 16:34:21 +0100 Subject: [PATCH] Don't override PerformError with normal errors --- roomserver/internal/perform_invite.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/roomserver/internal/perform_invite.go b/roomserver/internal/perform_invite.go index 75a1d49a6..9f883a562 100644 --- a/roomserver/internal/perform_invite.go +++ b/roomserver/internal/perform_invite.go @@ -96,10 +96,10 @@ func (r *RoomserverInternalAPI) PerformInvite( // mechanism it will be equivalent to option 1, and we don't have a // signalling mechanism to implement option 3. res.Error = &api.PerformError{ - Code: api.PerformErrorNoOperation, + Code: api.PerformErrorNotAllowed, Msg: "User is already joined to room", } - return res.Error + return nil } if isOriginLocal { @@ -115,9 +115,9 @@ func (r *RoomserverInternalAPI) PerformInvite( Msg: err.Error(), Code: api.PerformErrorNotAllowed, } - return fmt.Errorf("checkAuthEvents: %w", err) + return nil } - return err + return fmt.Errorf("checkAuthEvents: %w", err) } // If the invite originated from us and the target isn't local then we @@ -136,7 +136,8 @@ func (r *RoomserverInternalAPI) PerformInvite( Msg: err.Error(), Code: api.PerformErrorNoOperation, } - return fmt.Errorf("r.fsAPI.PerformInvite: %w", err) + log.WithError(err).WithField("event_id", event.EventID()).Error("r.fsAPI.PerformInvite failed") + return nil } event = fsRes.SignedEvent }