Skip to content

Commit

Permalink
print body as-is when decoding fails
Browse files Browse the repository at this point in the history
  • Loading branch information
jandelgado committed Sep 22, 2024
1 parent af73bab commit 07011da
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/rabtap/message_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ func PrettyPrintMessage(out io.Writer, message rabtap.TapMessage) error {
printEnv := PrintMessageEnv{
Message: message,
Body: func() string {
b, err := Body(message.AmqpMessage)
if err != nil {
return "err" // TODO
if b, err := Body(message.AmqpMessage); err != nil {
log.Warnf("decoding failed, printing body as-is: %s", err)
return formatter.Format(message.AmqpMessage.Body)
} else {
return formatter.Format(b)
}
return formatter.Format(b)
},
}

Expand Down

0 comments on commit 07011da

Please sign in to comment.