mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-05 15:42:46 +00:00
Move json errors over to gmsl (#3080)
This commit is contained in:
parent
a49c9f01e2
commit
0489d16f95
109 changed files with 808 additions and 1217 deletions
|
@ -21,7 +21,6 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/matrix-org/dendrite/clientapi/jsonerror"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
"github.com/matrix-org/dendrite/roomserver/types"
|
||||
"github.com/matrix-org/dendrite/setup/config"
|
||||
|
@ -50,7 +49,7 @@ func Backfill(
|
|||
if _, _, err = gomatrixserverlib.SplitID('!', roomID); err != nil {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.MissingArgument("Bad room ID: " + err.Error()),
|
||||
JSON: spec.MissingParam("Bad room ID: " + err.Error()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,14 +64,14 @@ func Backfill(
|
|||
if !exists {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.MissingArgument("v is missing"),
|
||||
JSON: spec.MissingParam("v is missing"),
|
||||
}
|
||||
}
|
||||
limit = httpReq.URL.Query().Get("limit")
|
||||
if len(limit) == 0 {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.MissingArgument("limit is missing"),
|
||||
JSON: spec.MissingParam("limit is missing"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,14 +91,14 @@ func Backfill(
|
|||
util.GetLogger(httpReq.Context()).WithError(err).Error("strconv.Atoi failed")
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.InvalidArgumentValue(fmt.Sprintf("limit %q is invalid format", limit)),
|
||||
JSON: spec.InvalidParam(fmt.Sprintf("limit %q is invalid format", limit)),
|
||||
}
|
||||
}
|
||||
|
||||
// Query the roomserver.
|
||||
if err = rsAPI.PerformBackfill(httpReq.Context(), &req, &res); err != nil {
|
||||
util.GetLogger(httpReq.Context()).WithError(err).Error("query.PerformBackfill failed")
|
||||
return jsonerror.InternalServerError()
|
||||
return spec.InternalServerError()
|
||||
}
|
||||
|
||||
// Filter any event that's not from the requested room out.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue