aboutsummaryrefslogtreecommitdiff
path: root/federationapi/routing/profile.go
diff options
context:
space:
mode:
authordevonh <devon.dmytro@gmail.com>2023-05-09 22:46:49 +0000
committerGitHub <noreply@github.com>2023-05-09 22:46:49 +0000
commit0489d16f95a3d9f1f5bc532e2060bd2482d7b156 (patch)
treea0573b5a0c21ca563e97abae81e36d66ad14e7d8 /federationapi/routing/profile.go
parenta49c9f01e227aeb12aa2f27d5bf1915453c23a3b (diff)
Move json errors over to gmsl (#3080)
Diffstat (limited to 'federationapi/routing/profile.go')
-rw-r--r--federationapi/routing/profile.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/federationapi/routing/profile.go b/federationapi/routing/profile.go
index 55641b21..7d6cfcaa 100644
--- a/federationapi/routing/profile.go
+++ b/federationapi/routing/profile.go
@@ -18,10 +18,10 @@ import (
"fmt"
"net/http"
- "github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/internal/eventutil"
"github.com/matrix-org/dendrite/setup/config"
userapi "github.com/matrix-org/dendrite/userapi/api"
+ "github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
)
@@ -37,7 +37,7 @@ func GetProfile(
if userID == "" {
return util.JSONResponse{
Code: http.StatusBadRequest,
- JSON: jsonerror.MissingArgument("The request body did not contain required argument 'user_id'."),
+ JSON: spec.MissingParam("The request body did not contain required argument 'user_id'."),
}
}
@@ -46,14 +46,14 @@ func GetProfile(
util.GetLogger(httpReq.Context()).WithError(err).Error("gomatrixserverlib.SplitID failed")
return util.JSONResponse{
Code: http.StatusBadRequest,
- JSON: jsonerror.InvalidArgumentValue(fmt.Sprintf("Domain %q does not match this server", domain)),
+ JSON: spec.InvalidParam(fmt.Sprintf("Domain %q does not match this server", domain)),
}
}
profile, err := userAPI.QueryProfile(httpReq.Context(), userID)
if err != nil {
util.GetLogger(httpReq.Context()).WithError(err).Error("userAPI.QueryProfile failed")
- return jsonerror.InternalServerError()
+ return spec.InternalServerError()
}
var res interface{}
@@ -71,7 +71,7 @@ func GetProfile(
}
default:
code = http.StatusBadRequest
- res = jsonerror.InvalidArgumentValue("The request body did not contain an allowed value of argument 'field'. Allowed values are either: 'avatar_url', 'displayname'.")
+ res = spec.InvalidParam("The request body did not contain an allowed value of argument 'field'. Allowed values are either: 'avatar_url', 'displayname'.")
}
} else {
res = eventutil.UserProfile{