Skip to content

Commit

Permalink
connector/edits: prettify error messages
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Nov 21, 2024
1 parent 844f318 commit 22f4473
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/connector/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 22f4473

Please sign in to comment.