From 71d26b3fc5ff8795cdda7620be65b60abdd2182c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Br=C3=BCderl?= Date: Fri, 27 Mar 2020 00:03:27 +0100 Subject: [PATCH] return error if wrong proto type was given or loading was not possible --- cmd/kaf/produce.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/kaf/produce.go b/cmd/kaf/produce.go index 0216fda6..d75fa11c 100644 --- a/cmd/kaf/produce.go +++ b/cmd/kaf/produce.go @@ -70,6 +70,8 @@ var produceCmd = &cobra.Command{ } data = pb + } else { + errorExit("Failed to load payload proto type") } } @@ -86,7 +88,10 @@ var produceCmd = &cobra.Command{ } key = sarama.ByteEncoder(pb) + } else { + errorExit("Failed to load key proto type") } + } var ts time.Time @@ -110,7 +115,6 @@ var produceCmd = &cobra.Command{ } fmt.Printf("Sent record to partition %v at offset %v.\n", partition, offset) - } },