Return 500 when processing a transaction fails fatally (#1066)

This commit is contained in:
Neil Alexander 2020-05-27 11:16:27 +01:00 committed by GitHub
parent a7f12bce79
commit 406b47267e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,6 +76,7 @@ func Send(
resp, err := t.processTransaction() resp, err := t.processTransaction()
if err != nil { if err != nil {
util.GetLogger(httpReq.Context()).WithError(err).Error("t.processTransaction failed") util.GetLogger(httpReq.Context()).WithError(err).Error("t.processTransaction failed")
return util.ErrorResponse(err)
} }
// https://matrix.org/docs/spec/server_server/r0.1.3#put-matrix-federation-v1-send-txnid // https://matrix.org/docs/spec/server_server/r0.1.3#put-matrix-federation-v1-send-txnid
@ -117,7 +118,7 @@ type txnFederationClient interface {
func (t *txnReq) processTransaction() (*gomatrixserverlib.RespSend, error) { func (t *txnReq) processTransaction() (*gomatrixserverlib.RespSend, error) {
results := make(map[string]gomatrixserverlib.PDUResult) results := make(map[string]gomatrixserverlib.PDUResult)
var pdus []gomatrixserverlib.HeaderedEvent pdus := []gomatrixserverlib.HeaderedEvent{}
for _, pdu := range t.PDUs { for _, pdu := range t.PDUs {
var header struct { var header struct {
RoomID string `json:"room_id"` RoomID string `json:"room_id"`