Use consistent error message for media not found errors

Sometimes it's encrypted, sometimes it's not
This commit is contained in:
Tulir Asokan 2022-05-02 16:50:13 +03:00
parent fdb0718670
commit 289d410a4b

View file

@ -2304,7 +2304,11 @@ func (portal *Portal) handleMediaRetry(retry *events.MediaRetry, source *User) {
errorName := waProto.MediaRetryNotification_MediaRetryNotificationResultType_name[int32(retryData.GetResult())] errorName := waProto.MediaRetryNotification_MediaRetryNotificationResultType_name[int32(retryData.GetResult())]
portal.log.Warnfln("Got error response in media retry notification for %s: %s", retry.MessageID, errorName) portal.log.Warnfln("Got error response in media retry notification for %s: %s", retry.MessageID, errorName)
portal.log.Debugfln("Error response contents: %s / %s", retryData.GetStanzaId(), retryData.GetDirectPath()) portal.log.Debugfln("Error response contents: %s / %s", retryData.GetStanzaId(), retryData.GetDirectPath())
if retryData.GetResult() == waProto.MediaRetryNotification_NOT_FOUND {
portal.sendMediaRetryFailureEdit(intent, msg, whatsmeow.ErrMediaNotAvailableOnPhone)
} else {
portal.sendMediaRetryFailureEdit(intent, msg, fmt.Errorf("phone sent error response: %s", errorName)) portal.sendMediaRetryFailureEdit(intent, msg, fmt.Errorf("phone sent error response: %s", errorName))
}
return return
} }