From 386b6aa528bfc0f1aff241f501c8c253d44f0011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Wed, 21 Dec 2022 18:34:29 +0100 Subject: [PATCH] Do not log nil error in bulk indexer --- esutil/bulk_indexer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esutil/bulk_indexer.go b/esutil/bulk_indexer.go index 3ff65a7091..954f874baa 100644 --- a/esutil/bulk_indexer.go +++ b/esutil/bulk_indexer.go @@ -592,7 +592,7 @@ func (w *worker) flush(ctx context.Context) error { atomic.AddUint64(&w.bi.stats.numFailed, uint64(len(w.items))) // TODO(karmi): Wrap error (include response struct) if w.bi.config.OnError != nil { - w.bi.config.OnError(ctx, fmt.Errorf("flush: %s", err)) + w.bi.config.OnError(ctx, fmt.Errorf("flush: %s", res.String())) } return fmt.Errorf("flush: %s", res.String()) }