aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-10-09 15:06:43 +0100
committerGitHub <noreply@github.com>2020-10-09 15:06:43 +0100
commit4df7e345bb8a8182c50666e40023909f27f5d607 (patch)
tree25dcebad917d05dd33d35beec9cd04434508237b
parent2bd0449c5b2b5cbefffbe145f6c4c183e4ff0552 (diff)
Only return 500 on /send if a database error occurs (#1503)
-rw-r--r--federationapi/routing/send.go16
1 files changed, 5 insertions, 11 deletions
diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go
index e2ab9b33..fe429521 100644
--- a/federationapi/routing/send.go
+++ b/federationapi/routing/send.go
@@ -16,6 +16,7 @@ package routing
import (
"context"
+ "database/sql"
"encoding/json"
"fmt"
"net/http"
@@ -234,17 +235,10 @@ func (t *txnReq) processTransaction(ctx context.Context) (*gomatrixserverlib.Res
// we should stop processing the transaction, and returns false if it
// is just some less serious error about a specific event.
func isProcessingErrorFatal(err error) bool {
- switch err.(type) {
- case roomNotFoundError:
- case *gomatrixserverlib.NotAllowed:
- case missingPrevEventsError:
- default:
- switch err {
- case context.Canceled:
- case context.DeadlineExceeded:
- default:
- return true
- }
+ switch err {
+ case sql.ErrConnDone:
+ case sql.ErrTxDone:
+ return true
}
return false
}