Don't override PerformError with normal errors

This commit is contained in:
Neil Alexander 2020-08-14 16:34:21 +01:00
parent acfe792ea1
commit 51c642b8ad
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -96,10 +96,10 @@ func (r *RoomserverInternalAPI) PerformInvite(
// mechanism it will be equivalent to option 1, and we don't have a // mechanism it will be equivalent to option 1, and we don't have a
// signalling mechanism to implement option 3. // signalling mechanism to implement option 3.
res.Error = &api.PerformError{ res.Error = &api.PerformError{
Code: api.PerformErrorNoOperation, Code: api.PerformErrorNotAllowed,
Msg: "User is already joined to room", Msg: "User is already joined to room",
} }
return res.Error return nil
} }
if isOriginLocal { if isOriginLocal {
@ -115,9 +115,9 @@ func (r *RoomserverInternalAPI) PerformInvite(
Msg: err.Error(), Msg: err.Error(),
Code: api.PerformErrorNotAllowed, 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 // 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(), Msg: err.Error(),
Code: api.PerformErrorNoOperation, 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 event = fsRes.SignedEvent
} }