diff --git a/connectors/telegram/telegram.go b/connectors/telegram/telegram.go index 6c6c6b3..4328f2e 100644 --- a/connectors/telegram/telegram.go +++ b/connectors/telegram/telegram.go @@ -289,8 +289,8 @@ func (t *telegram) call(ctx context.Context, method string, body, out any) error } if !env.OK { err := fmt.Errorf("%s: %s", method, env.Description) - // Telegram answers 400, 403 and 404 for a request it will refuse - // again: a bad message, a blocked bot, a missing chat. + // Telegram returns 400, 403 and 404 for requests that will fail again: + // an invalid message, a blocked bot or a missing chat. switch cmp.Or(env.ErrorCode, res.StatusCode) { case http.StatusBadRequest, http.StatusForbidden, http.StatusNotFound: return connector.Permanent(err) diff --git a/sdk/connector/permanent.go b/sdk/connector/permanent.go index 593743b..850c595 100644 --- a/sdk/connector/permanent.go +++ b/sdk/connector/permanent.go @@ -2,15 +2,16 @@ package connector import "errors" -// permanentError marks a delivery failure no retry can fix. +// permanentError marks a delivery failure that retrying cannot fix. type permanentError struct{ err error } func (e *permanentError) Error() string { return e.err.Error() } func (e *permanentError) Unwrap() error { return e.err } -// Permanent marks err as a refusal the same delivery will meet again, such as a -// message the service says is invalid or a chat that is gone. The host records -// the reason and stops retrying it; any other Deliver error is retried. +// Permanent marks err as a permanent rejection that the same delivery would +// receive again, such as a message the service considers invalid or a chat +// that no longer exists. The host records the reason and stops retrying; any +// other Deliver error is retried. func Permanent(err error) error { if err == nil { return nil