Log more information about gomatrix.HTTPError

This commit is contained in:
Neil Alexander 2021-07-27 14:26:37 +01:00
parent a060df91e2
commit 39ceb8156e
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -415,7 +415,7 @@ func (oq *destinationQueue) nextTransaction(
ctx, cancel := context.WithTimeout(oq.process.Context(), time.Minute*5) ctx, cancel := context.WithTimeout(oq.process.Context(), time.Minute*5)
defer cancel() defer cancel()
_, err := oq.client.SendTransaction(ctx, t) _, err := oq.client.SendTransaction(ctx, t)
switch err.(type) { switch e := err.(type) {
case nil: case nil:
// Clean up the transaction in the database. // Clean up the transaction in the database.
if pduReceipts != nil { if pduReceipts != nil {
@ -438,6 +438,7 @@ func (oq *destinationQueue) nextTransaction(
case gomatrix.HTTPError: case gomatrix.HTTPError:
// Report that we failed to send the transaction and we // Report that we failed to send the transaction and we
// will retry again, subject to backoff. // will retry again, subject to backoff.
log.WithError(err).WithField("code", e.Code).WithField("message", e.Message).WithField("content", string(e.Contents)).Error("gomatrix.HTTPError when sending transaction")
return false, 0, 0, err return false, 0, 0, err
default: default:
log.WithFields(log.Fields{ log.WithFields(log.Fields{