From fcf857402bff3f87250bd7da55c1934473ea4adc Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Fri, 9 Jun 2023 09:09:18 -0600 Subject: [PATCH] Fix clientapi error messaging to make sense --- clientapi/routing/account_data.go | 8 ++++---- clientapi/routing/directory.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/clientapi/routing/account_data.go b/clientapi/routing/account_data.go index a6477fdea..a2c1596e0 100644 --- a/clientapi/routing/account_data.go +++ b/clientapi/routing/account_data.go @@ -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"), } } diff --git a/clientapi/routing/directory.go b/clientapi/routing/directory.go index 516a158e1..e9fc8e466 100644 --- a/clientapi/routing/directory.go +++ b/clientapi/routing/directory.go @@ -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"), } }