Fix clientapi error messaging to make sense

This commit is contained in:
Devon Hudson 2023-06-09 09:09:18 -06:00
parent 6383a859e8
commit fcf857402b
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628
2 changed files with 8 additions and 8 deletions

View file

@ -148,15 +148,15 @@ func SaveReadMarker(
fullUserID, err := spec.NewUserID(device.UserID, true)
if err != nil {
return util.JSONResponse{
Code: http.StatusForbidden,
JSON: spec.Forbidden("userID doesn't have power level to change visibility"),
Code: http.StatusBadRequest,
JSON: spec.BadJSON("userID for this device is invalid"),
}
}
senderID, err := rsAPI.QuerySenderIDForUser(req.Context(), roomID, *fullUserID)
if err != nil {
return util.JSONResponse{
Code: http.StatusForbidden,
JSON: spec.Forbidden("userID doesn't have power level to change visibility"),
Code: http.StatusBadRequest,
JSON: spec.Unknown("failed to find senderID for this user"),
}
}

View file

@ -317,15 +317,15 @@ func SetVisibility(
fullUserID, err := spec.NewUserID(dev.UserID, true)
if err != nil {
return util.JSONResponse{
Code: http.StatusForbidden,
JSON: spec.Forbidden("userID doesn't have power level to change visibility"),
Code: http.StatusBadRequest,
JSON: spec.BadJSON("userID for this device is invalid"),
}
}
senderID, err := rsAPI.QuerySenderIDForUser(req.Context(), roomID, *fullUserID)
if err != nil {
return util.JSONResponse{
Code: http.StatusForbidden,
JSON: spec.Forbidden("userID doesn't have power level to change visibility"),
Code: http.StatusBadRequest,
JSON: spec.Unknown("failed to find senderID for this user"),
}
}