Merge pull request 'missing error handling' (#539) from tg-537 into main
All checks were successful
ci/woodpecker/push/gateway_tgsettle Pipeline was successful

Reviewed-on: #539
This commit was merged in pull request #539.
This commit is contained in:
2026-02-19 20:35:27 +00:00

View File

@@ -154,7 +154,7 @@ func (s *Service) onTelegramUpdate(ctx context.Context, update *model.TelegramWe
return err
}
if pending == nil {
s.logger.Info("Telegram confirmation reply dropped",
s.logger.Warn("Telegram confirmation reply dropped",
append(replyFields,
zap.String("outcome", "dropped"),
zap.String("reason", "no_pending_confirmation"),
@@ -187,7 +187,7 @@ func (s *Service) onTelegramUpdate(ctx context.Context, update *model.TelegramWe
}
if strings.TrimSpace(message.ChatID) != strings.TrimSpace(pending.TargetChatID) {
s.logger.Info("Telegram confirmation reply dropped",
s.logger.Warn("Telegram confirmation reply dropped",
append(replyFields,
zap.String("outcome", "dropped"),
zap.String("reason", "chat_mismatch"),
@@ -206,12 +206,14 @@ func (s *Service) onTelegramUpdate(ctx context.Context, update *model.TelegramWe
if err := s.publishPendingConfirmationResult(pending, result); err != nil {
return err
}
_ = s.sendTelegramText(ctx, &model.TelegramTextRequest{
if e := s.sendTelegramText(ctx, &model.TelegramTextRequest{
RequestID: pending.RequestID,
ChatID: pending.TargetChatID,
ReplyToMessageID: message.MessageID,
Text: "Only approved users can confirm this payment.",
})
}); e != nil {
s.logger.Warn("Failed to create telegram text", append(replyFields, zap.Error(err))...)
}
if err := s.clearPendingConfirmation(ctx, pending.RequestID); err != nil {
return err
}
@@ -229,13 +231,15 @@ func (s *Service) onTelegramUpdate(ctx context.Context, update *model.TelegramWe
if markErr := s.repo.PendingConfirmations().MarkClarified(ctx, pending.RequestID); markErr != nil {
s.logger.Warn("Failed to mark confirmation as clarified", zap.Error(markErr), zap.String("request_id", pending.RequestID))
}
_ = s.sendTelegramText(ctx, &model.TelegramTextRequest{
if e := s.sendTelegramText(ctx, &model.TelegramTextRequest{
RequestID: pending.RequestID,
ChatID: pending.TargetChatID,
ReplyToMessageID: message.MessageID,
Text: clarificationMessage(reason),
})
s.logger.Info("Telegram confirmation reply dropped",
}); e != nil {
s.logger.Warn("Failed to create telegram text", append(replyFields, zap.Error(err))...)
}
s.logger.Warn("Telegram confirmation reply dropped",
append(replyFields,
zap.String("outcome", "dropped"),
zap.String("reason", "invalid_reply_format"),