21 lines
514 B
Go
21 lines
514 B
Go
package telegram
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"github.com/go-telegram/bot"
|
|
)
|
|
|
|
// pipelineErrorHandler logs update-loop failures.
|
|
func (g *Gateway) pipelineErrorHandler(ctx context.Context) func(error) {
|
|
return func(err error) {
|
|
if tooMany, ok := errors.AsType[*bot.TooManyRequestsError](err); ok {
|
|
g.log.WarnContext(ctx, "telegram rate limited", "retry_after", tooMany.RetryAfter,
|
|
"component", "gateway-telegram")
|
|
return
|
|
}
|
|
g.log.ErrorContext(ctx, "telegram pipeline error", "error", err)
|
|
}
|
|
}
|