From 4344ae89e05f12f890cb96bdadda29f9ac543e15 Mon Sep 17 00:00:00 2001 From: Stephan D Date: Thu, 19 Feb 2026 21:35:04 +0100 Subject: [PATCH] missing error handling --- .../service/gateway/confirmation_flow.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/api/gateway/tgsettle/internal/service/gateway/confirmation_flow.go b/api/gateway/tgsettle/internal/service/gateway/confirmation_flow.go index 5abc0eed..150a4868 100644 --- a/api/gateway/tgsettle/internal/service/gateway/confirmation_flow.go +++ b/api/gateway/tgsettle/internal/service/gateway/confirmation_flow.go @@ -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"), -- 2.49.1