mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Add custom error for rejecting server notice invite
This commit is contained in:
parent
2e1e0c81a1
commit
2dc7088de2
|
|
@ -149,6 +149,15 @@ func MissingParam(msg string) *MatrixError {
|
||||||
return &MatrixError{"M_MISSING_PARAM", msg}
|
return &MatrixError{"M_MISSING_PARAM", msg}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LeaveServerNoticeError is an error returned when trying to reject an invite
|
||||||
|
// for a server notice room.
|
||||||
|
func LeaveServerNoticeError() *MatrixError {
|
||||||
|
return &MatrixError{
|
||||||
|
ErrCode: "M_CANNOT_LEAVE_SERVER_NOTICE_ROOM",
|
||||||
|
Err: "You cannot reject this invite",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type IncompatibleRoomVersionError struct {
|
type IncompatibleRoomVersionError struct {
|
||||||
RoomVersion string `json:"room_version"`
|
RoomVersion string `json:"room_version"`
|
||||||
Error string `json:"error"`
|
Error string `json:"error"`
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ func LeaveRoomByID(
|
||||||
if leaveRes.Code != 0 {
|
if leaveRes.Code != 0 {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: leaveRes.Code,
|
Code: leaveRes.Code,
|
||||||
JSON: jsonerror.Forbidden(leaveRes.Message),
|
JSON: jsonerror.LeaveServerNoticeError(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue