Skip to content

Commit

Permalink
fix: log batch item error
Browse files Browse the repository at this point in the history
We were reporting the batch item error towards backend, but not
adequately surfacing it in local logs.
  • Loading branch information
jta committed Jun 10, 2024
1 parent 58e16d3 commit 7311ede
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/handler/forwarder/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ func (h *Handler) ProcessRecord(ctx context.Context, record *events.SQSMessage)
}

func (h *Handler) Handle(ctx context.Context, request events.SQSEvent) (response events.SQSEventResponse, err error) {
logger := logr.FromContextOrDiscard(ctx)

resultCh := make(chan *SQSMessage, len(request.Records))
defer close(resultCh)

Expand All @@ -180,6 +182,7 @@ func (h *Handler) Handle(ctx context.Context, request events.SQSEvent) (response
defer releaseToken()
result := &SQSMessage{SQSMessage: m}
if err := h.ProcessRecord(ctx, &m); err != nil {
logger.Error(err, "failed to process record")
result.ErrorMessage = err.Error()
}
resultCh <- result
Expand Down

0 comments on commit 7311ede

Please sign in to comment.