From 22f44734cf8f59f601da13c24ef46285e27d0419 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Thu, 21 Nov 2024 12:22:11 -0700 Subject: [PATCH] connector/edits: prettify error messages Signed-off-by: Sumner Evans --- pkg/connector/matrix.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/connector/matrix.go b/pkg/connector/matrix.go index 3e0e6f1c..b1ca7fc5 100644 --- a/pkg/connector/matrix.go +++ b/pkg/connector/matrix.go @@ -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()