aboutsummaryrefslogtreecommitdiff
path: root/clientapi/routing/sendevent.go
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-06-04 10:53:39 +0100
committerGitHub <noreply@github.com>2020-06-04 10:53:39 +0100
commit8a6152ca70aa86df651db54efb3b1ec68ec9ec78 (patch)
treeb08e70cd3c92f24968be0a5477d285be0dcb80cd /clientapi/routing/sendevent.go
parente21d7d4bafb8c785e75369bebd5270cc67cb36d4 (diff)
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
Diffstat (limited to 'clientapi/routing/sendevent.go')
-rw-r--r--clientapi/routing/sendevent.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/clientapi/routing/sendevent.go b/clientapi/routing/sendevent.go
index aa731709..a8f8893b 100644
--- a/clientapi/routing/sendevent.go
+++ b/clientapi/routing/sendevent.go
@@ -154,6 +154,11 @@ func generateSendEvent(
Code: http.StatusNotFound,
JSON: jsonerror.NotFound("Room does not exist"),
}
+ } else if e, ok := err.(gomatrixserverlib.BadJSONError); ok {
+ return nil, &util.JSONResponse{
+ Code: http.StatusBadRequest,
+ JSON: jsonerror.BadJSON(e.Error()),
+ }
} else if err != nil {
util.GetLogger(req.Context()).WithError(err).Error("internal.BuildEvent failed")
resErr := jsonerror.InternalServerError()