mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-14 09:23:51 +01:00
Include event type in bridging error messages
This commit is contained in:
parent
ec9e6d517f
commit
d6fe852efa
1 changed files with 4 additions and 4 deletions
|
@ -105,7 +105,7 @@ func errorToStatusReason(err error) (reason event.MessageStatusReason, status ev
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (portal *Portal) sendErrorMessage(evt *event.Event, err error, confirmed bool, editID id.EventID) id.EventID {
|
func (portal *Portal) sendErrorMessage(evt *event.Event, err error, msgType string, confirmed bool, editID id.EventID) id.EventID {
|
||||||
if !portal.bridge.Config.Bridge.MessageErrorNotices {
|
if !portal.bridge.Config.Bridge.MessageErrorNotices {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@ -113,9 +113,9 @@ func (portal *Portal) sendErrorMessage(evt *event.Event, err error, confirmed bo
|
||||||
if confirmed {
|
if confirmed {
|
||||||
certainty = "was not"
|
certainty = "was not"
|
||||||
}
|
}
|
||||||
msg := fmt.Sprintf("\u26a0 Your message %s bridged: %v", certainty, err)
|
msg := fmt.Sprintf("\u26a0 Your %s %s bridged: %v", msgType, certainty, err)
|
||||||
if errors.Is(err, errMessageTakingLong) {
|
if errors.Is(err, errMessageTakingLong) {
|
||||||
msg = "\u26a0 Bridging your message is taking longer than usual"
|
msg = fmt.Sprintf("\u26a0 Bridging your %s is taking longer than usual", msgType)
|
||||||
}
|
}
|
||||||
content := &event.MessageEventContent{
|
content := &event.MessageEventContent{
|
||||||
MsgType: event.MsgNotice,
|
MsgType: event.MsgNotice,
|
||||||
|
@ -206,7 +206,7 @@ func (portal *Portal) sendMessageMetrics(evt *event.Event, err error, part strin
|
||||||
checkpointStatus := status.ReasonToCheckpointStatus(reason, statusCode)
|
checkpointStatus := status.ReasonToCheckpointStatus(reason, statusCode)
|
||||||
portal.bridge.SendMessageCheckpoint(evt, status.MsgStepRemote, err, checkpointStatus, ms.getRetryNum())
|
portal.bridge.SendMessageCheckpoint(evt, status.MsgStepRemote, err, checkpointStatus, ms.getRetryNum())
|
||||||
if sendNotice {
|
if sendNotice {
|
||||||
ms.setNoticeID(portal.sendErrorMessage(evt, err, isCertain, ms.getNoticeID()))
|
ms.setNoticeID(portal.sendErrorMessage(evt, err, msgType, isCertain, ms.getNoticeID()))
|
||||||
}
|
}
|
||||||
portal.sendStatusEvent(origEvtID, evt.ID, err)
|
portal.sendStatusEvent(origEvtID, evt.ID, err)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue