Return incompatible room version error

This commit is contained in:
Neil Alexander 2020-05-04 11:30:02 +01:00
parent 46c46f5532
commit 3b6a94f007
2 changed files with 8 additions and 3 deletions

View file

@ -18,6 +18,7 @@ import (
"fmt"
"net/http"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util"
)
@ -124,6 +125,12 @@ func GuestAccessForbidden(msg string) *MatrixError {
return &MatrixError{"M_GUEST_ACCESS_FORBIDDEN", msg}
}
// IncompatibleRoomVersion is an error which is returned when the client
// requests a room with a version that is unsupported.
func IncompatibleRoomVersion(roomVersion gomatrixserverlib.RoomVersion) *MatrixError {
return &MatrixError{"M_INCOMPATIBLE_ROOM_VERSION", string(roomVersion)}
}
// UnsupportedRoomVersion is an error which is returned when the client
// requests a room with a version that is unsupported.
func UnsupportedRoomVersion(msg string) *MatrixError {

View file

@ -62,9 +62,7 @@ func MakeJoin(
if !remoteSupportsVersion {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.UnsupportedRoomVersion(
fmt.Sprintf("Joining server does not support room version %s", verRes.RoomVersion),
),
JSON: jsonerror.IncompatibleRoomVersion(verRes.RoomVersion),
}
}