From f848ea9a20c2d2da0fc22ea8b5c60075bcb78575 Mon Sep 17 00:00:00 2001 From: Alena Varkockova Date: Sun, 29 May 2022 19:46:55 +0200 Subject: [PATCH] do not use logger.Fatal when testing connection this makes it impossible to use the method from a library. --- kafka/service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kafka/service.go b/kafka/service.go index 2370c7c..b2d8d73 100644 --- a/kafka/service.go +++ b/kafka/service.go @@ -48,7 +48,7 @@ func (s *Service) CreateAndTestClient(ctx context.Context, l *zap.Logger, opts [ defer cancel() err = s.testConnection(client, connectCtx) if err != nil { - logger.Fatal("failed to test connectivity to Kafka cluster", zap.Error(err)) + return nil, fmt.Errorf("failed to test connectivity to Kafka cluster %w", err) } return client, nil