mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 03:43:11 -06:00
Return incompatible room version error
This commit is contained in:
parent
46c46f5532
commit
3b6a94f007
|
|
@ -18,6 +18,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -124,6 +125,12 @@ func GuestAccessForbidden(msg string) *MatrixError {
|
||||||
return &MatrixError{"M_GUEST_ACCESS_FORBIDDEN", msg}
|
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
|
// UnsupportedRoomVersion is an error which is returned when the client
|
||||||
// requests a room with a version that is unsupported.
|
// requests a room with a version that is unsupported.
|
||||||
func UnsupportedRoomVersion(msg string) *MatrixError {
|
func UnsupportedRoomVersion(msg string) *MatrixError {
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,7 @@ func MakeJoin(
|
||||||
if !remoteSupportsVersion {
|
if !remoteSupportsVersion {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: jsonerror.UnsupportedRoomVersion(
|
JSON: jsonerror.IncompatibleRoomVersion(verRes.RoomVersion),
|
||||||
fmt.Sprintf("Joining server does not support room version %s", verRes.RoomVersion),
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue