Skip to content

Commit 899e288

Browse files
committed
chore: log kafka message when failed to decode json
1 parent dab7d0f commit 899e288

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ func main() {
3434
log.Err(err).Msg("failed to read kafka message")
3535
continue
3636
}
37+
38+
if len(msg.Value) == 0 {
39+
continue
40+
}
41+
3742
var m KafkaMessageValue[ChiiInterest]
3843
err = json.Unmarshal(msg.Value, &m)
3944
if err != nil {
40-
log.Err(err).Msg("failed to decode kafka message as json")
45+
log.Err(err).Bytes("value", msg.Value).Msg("failed to decode kafka message as json")
4146
continue
4247
}
4348

0 commit comments

Comments
 (0)