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
|
@ -17,10 +17,10 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"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/gomatrixserverlib/fclient"
|
||||
"github.com/matrix-org/gomatrixserverlib/spec"
|
||||
"github.com/matrix-org/util"
|
||||
)
|
||||
|
||||
|
@ -88,7 +88,7 @@ func parseEventIDParam(
|
|||
if eventID == "" {
|
||||
resErr = &util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.MissingArgument("event_id missing"),
|
||||
JSON: spec.MissingParam("event_id missing"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ func getState(
|
|||
}
|
||||
|
||||
if event.RoomID() != roomID {
|
||||
return nil, nil, &util.JSONResponse{Code: http.StatusNotFound, JSON: jsonerror.NotFound("event does not belong to this room")}
|
||||
return nil, nil, &util.JSONResponse{Code: http.StatusNotFound, JSON: spec.NotFound("event does not belong to this room")}
|
||||
}
|
||||
resErr = allowedToSeeEvent(ctx, request.Origin(), rsAPI, eventID)
|
||||
if resErr != nil {
|
||||
|
@ -140,17 +140,17 @@ func getState(
|
|||
case !response.RoomExists:
|
||||
return nil, nil, &util.JSONResponse{
|
||||
Code: http.StatusNotFound,
|
||||
JSON: jsonerror.NotFound("Room not found"),
|
||||
JSON: spec.NotFound("Room not found"),
|
||||
}
|
||||
case !response.StateKnown:
|
||||
return nil, nil, &util.JSONResponse{
|
||||
Code: http.StatusNotFound,
|
||||
JSON: jsonerror.NotFound("State not known"),
|
||||
JSON: spec.NotFound("State not known"),
|
||||
}
|
||||
case response.IsRejected:
|
||||
return nil, nil, &util.JSONResponse{
|
||||
Code: http.StatusNotFound,
|
||||
JSON: jsonerror.NotFound("Event not found"),
|
||||
JSON: spec.NotFound("Event not found"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue