aboutsummaryrefslogtreecommitdiff
path: root/clientapi/routing/redaction.go
diff options
context:
space:
mode:
Diffstat (limited to 'clientapi/routing/redaction.go')
-rw-r--r--clientapi/routing/redaction.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/clientapi/routing/redaction.go b/clientapi/routing/redaction.go
index 12391d26..ed70e5c5 100644
--- a/clientapi/routing/redaction.go
+++ b/clientapi/routing/redaction.go
@@ -16,6 +16,7 @@ package routing
import (
"context"
+ "errors"
"net/http"
"time"
@@ -121,17 +122,23 @@ func SendRedaction(
err := proto.SetContent(r)
if err != nil {
util.GetLogger(req.Context()).WithError(err).Error("proto.SetContent failed")
- return spec.InternalServerError()
+ return util.JSONResponse{
+ Code: http.StatusInternalServerError,
+ JSON: spec.InternalServerError{},
+ }
}
identity, err := cfg.Matrix.SigningIdentityFor(device.UserDomain())
if err != nil {
- return spec.InternalServerError()
+ return util.JSONResponse{
+ Code: http.StatusInternalServerError,
+ JSON: spec.InternalServerError{},
+ }
}
var queryRes roomserverAPI.QueryLatestEventsAndStateResponse
e, err := eventutil.QueryAndBuildEvent(req.Context(), &proto, cfg.Matrix, identity, time.Now(), rsAPI, &queryRes)
- if err == eventutil.ErrRoomNoExists {
+ if errors.Is(err, eventutil.ErrRoomNoExists{}) {
return util.JSONResponse{
Code: http.StatusNotFound,
JSON: spec.NotFound("Room does not exist"),
@@ -140,7 +147,10 @@ func SendRedaction(
domain := device.UserDomain()
if err = roomserverAPI.SendEvents(context.Background(), rsAPI, roomserverAPI.KindNew, []*types.HeaderedEvent{e}, device.UserDomain(), domain, domain, nil, false); err != nil {
util.GetLogger(req.Context()).WithError(err).Errorf("failed to SendEvents")
- return spec.InternalServerError()
+ return util.JSONResponse{
+ Code: http.StatusInternalServerError,
+ JSON: spec.InternalServerError{},
+ }
}
res := util.JSONResponse{