mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Update error codes
This commit is contained in:
parent
43727e978d
commit
3300effe39
1 changed files with 6 additions and 11 deletions
|
@ -249,19 +249,11 @@ func (r *Joiner) performJoinRoomByID(
|
||||||
Msg: rerr.Error(),
|
Msg: rerr.Error(),
|
||||||
}
|
}
|
||||||
} else if restricted {
|
} else if restricted {
|
||||||
found := false
|
|
||||||
for _, roomID := range roomIDs {
|
for _, roomID := range roomIDs {
|
||||||
if err = r.attemptRestrictedJoinUsingRoomID(ctx, req, roomID, &eb); err == nil {
|
if err = r.attemptRestrictedJoinUsingRoomID(ctx, req, roomID, &eb); err == nil {
|
||||||
found = true
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !found {
|
|
||||||
return "", "", &rsAPI.PerformError{
|
|
||||||
Code: rsAPI.PerformErrorNotAllowed,
|
|
||||||
Msg: "You do not have permission to join this restricted room.",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to construct an actual join event from the template.
|
// Try to construct an actual join event from the template.
|
||||||
|
@ -305,7 +297,7 @@ func (r *Joiner) performJoinRoomByID(
|
||||||
if err = inputRes.Err(); err != nil {
|
if err = inputRes.Err(); err != nil {
|
||||||
return "", "", &rsAPI.PerformError{
|
return "", "", &rsAPI.PerformError{
|
||||||
Code: rsAPI.PerformErrorNotAllowed,
|
Code: rsAPI.PerformErrorNotAllowed,
|
||||||
Msg: fmt.Sprintf("InputRoomEvents auth failed: %s", err),
|
Msg: fmt.Sprintf("Failed to join the room %q: %s", req.RoomIDOrAlias, err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -321,7 +313,7 @@ func (r *Joiner) performJoinRoomByID(
|
||||||
if len(req.ServerNames) == 0 {
|
if len(req.ServerNames) == 0 {
|
||||||
return "", "", &rsAPI.PerformError{
|
return "", "", &rsAPI.PerformError{
|
||||||
Code: rsAPI.PerformErrorNoRoom,
|
Code: rsAPI.PerformErrorNoRoom,
|
||||||
Msg: fmt.Sprintf("room ID %q does not exist", req.RoomIDOrAlias),
|
Msg: fmt.Sprintf("Room ID %q does not exist!", req.RoomIDOrAlias),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,7 +324,10 @@ func (r *Joiner) performJoinRoomByID(
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Something else went wrong.
|
// Something else went wrong.
|
||||||
return "", "", fmt.Errorf("error joining local room: %q", err)
|
return "", "", &rsAPI.PerformError{
|
||||||
|
Code: rsAPI.PerformErrorNotAllowed,
|
||||||
|
Msg: fmt.Sprintf("Failed to join the room %q: %s", req.RoomIDOrAlias, err),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// By this point, if req.RoomIDOrAlias contained an alias, then
|
// By this point, if req.RoomIDOrAlias contained an alias, then
|
||||||
|
|
Loading…
Reference in a new issue