connector/edits: prettify error messages

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
Sumner Evans
2024-11-21 12:22:11 -07:00
parent 844f31827c
commit 22f44734cf
+4 -1
View File
@@ -173,7 +173,10 @@ func (t *TelegramClient) humanizeSendError(err error) bridgev2.MessageStatus {
case tg.IsEntityMentionUserInvalid(err):
status = status.WithMessage("You mentioned an invalid user").
WithErrorReason(event.MessageStatusUnsupported)
case tg.IsMessageEditTimeExpired(err):
status = status.WithMessage("You can't edit this message anymore, too much time has passed since its creation.")
default:
// Return a normal status with the default retriable status
return status
}
return status.WithIsCertain(true).
@@ -372,7 +375,7 @@ func (t *TelegramClient) HandleMatrixEdit(ctx context.Context, msg *bridgev2.Mat
}
updates, err := t.client.API().MessagesEditMessage(ctx, &req)
if err != nil {
return err
return t.humanizeSendError(err)
}
hasher := sha256.New()