mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 04:52:46 +00:00
Enable room version 6 (#1087)
* Return bad request on CS API /send if bad JSON * Return some more M_BAD_JSON in the right places * nolint because damnit gocyclo all I added was a type check for an error * Update gomatrixserverlib * Update gomatrixserverlib * Update sytest-whitelist * Update gomatrixserverlib * Update sytest-whitelist * NotJSON -> BadJSON
This commit is contained in:
parent
e21d7d4baf
commit
8a6152ca70
8 changed files with 56 additions and 7 deletions
|
@ -102,6 +102,11 @@ func MakeJoin(
|
|||
Code: http.StatusNotFound,
|
||||
JSON: jsonerror.NotFound("Room does not exist"),
|
||||
}
|
||||
} else if e, ok := err.(gomatrixserverlib.BadJSONError); ok {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.BadJSON(e.Error()),
|
||||
}
|
||||
} else if err != nil {
|
||||
util.GetLogger(httpReq.Context()).WithError(err).Error("internal.BuildEvent failed")
|
||||
return jsonerror.InternalServerError()
|
||||
|
@ -157,7 +162,7 @@ func SendJoin(
|
|||
if err != nil {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.NotJSON("The request body could not be decoded into valid JSON. " + err.Error()),
|
||||
JSON: jsonerror.BadJSON("The request body could not be decoded into valid JSON: " + err.Error()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,6 +76,11 @@ func MakeLeave(
|
|||
Code: http.StatusNotFound,
|
||||
JSON: jsonerror.NotFound("Room does not exist"),
|
||||
}
|
||||
} else if e, ok := err.(gomatrixserverlib.BadJSONError); ok {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.BadJSON(e.Error()),
|
||||
}
|
||||
} else if err != nil {
|
||||
util.GetLogger(httpReq.Context()).WithError(err).Error("internal.BuildEvent failed")
|
||||
return jsonerror.InternalServerError()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue