Move json errors over to gmsl (#3080)

This commit is contained in:
devonh 2023-05-09 22:46:49 +00:00 committed by GitHub
parent a49c9f01e2
commit 0489d16f95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
109 changed files with 808 additions and 1217 deletions

View file

@ -28,7 +28,6 @@ import (
"github.com/google/uuid"
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
fs "github.com/matrix-org/dendrite/federationapi/api"
"github.com/matrix-org/dendrite/internal/caching"
"github.com/matrix-org/dendrite/internal/httputil"
@ -96,7 +95,7 @@ func federatedSpacesHandler(
if err != nil {
return util.JSONResponse{
Code: 400,
JSON: jsonerror.InvalidParam("bad request uri"),
JSON: spec.InvalidParam("bad request uri"),
}
}
@ -214,13 +213,13 @@ func (w *walker) walk() util.JSONResponse {
// CS API format
return util.JSONResponse{
Code: 403,
JSON: jsonerror.Forbidden("room is unknown/forbidden"),
JSON: spec.Forbidden("room is unknown/forbidden"),
}
} else {
// SS API format
return util.JSONResponse{
Code: 404,
JSON: jsonerror.NotFound("room is unknown/forbidden"),
JSON: spec.NotFound("room is unknown/forbidden"),
}
}
}
@ -233,7 +232,7 @@ func (w *walker) walk() util.JSONResponse {
if cache == nil {
return util.JSONResponse{
Code: 400,
JSON: jsonerror.InvalidArgumentValue("invalid from"),
JSON: spec.InvalidParam("invalid from"),
}
}
} else {
@ -377,7 +376,7 @@ func (w *walker) walk() util.JSONResponse {
if len(discoveredRooms) == 0 {
return util.JSONResponse{
Code: 404,
JSON: jsonerror.NotFound("room is unknown/forbidden"),
JSON: spec.NotFound("room is unknown/forbidden"),
}
}
return util.JSONResponse{