mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-10 15:43:09 -06:00
Remove unnecessary error handling for invites
This commit is contained in:
parent
29759ea4db
commit
05e5837800
|
|
@ -42,20 +42,12 @@ func InviteV3(
|
|||
) util.JSONResponse {
|
||||
inviteReq := fclient.InviteV3Request{}
|
||||
err := json.Unmarshal(request.Content(), &inviteReq)
|
||||
switch e := err.(type) {
|
||||
case gomatrixserverlib.UnsupportedRoomVersionError:
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: spec.UnsupportedRoomVersion(
|
||||
fmt.Sprintf("Room version %q is not supported by this server.", e.Version),
|
||||
),
|
||||
}
|
||||
case gomatrixserverlib.BadJSONError:
|
||||
if err != nil {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: spec.BadJSON(err.Error()),
|
||||
}
|
||||
case nil:
|
||||
}
|
||||
if !cfg.Matrix.IsLocalServerName(invitedUser.Domain()) {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
|
|
@ -103,12 +95,6 @@ func InviteV3(
|
|||
Code: http.StatusOK,
|
||||
JSON: fclient.RespInviteV2{Event: event.JSON()},
|
||||
}
|
||||
default:
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: spec.NotJSON("The request body could not be decoded into an invite request. " + err.Error()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// InviteV2 implements /_matrix/federation/v2/invite/{roomID}/{eventID}
|
||||
|
|
|
|||
Loading…
Reference in a new issue