Skip to content

Commit

Permalink
Logged proto message when deserialization fails. #231
Browse files Browse the repository at this point in the history
  • Loading branch information
negiDharmendra authored and nehashri committed Jul 17, 2019
1 parent f07dfba commit 78a9400
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion listener/gaugeListener.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ func (gaugeListener *GaugeListener) processMessages(buffer *bytes.Buffer) {
if messageLength > 0 && messageLength < uint64(buffer.Len()) {
message := &gauge_messages.Message{}
messageBoundary := int(messageLength) + bytesRead
err := proto.Unmarshal(buffer.Bytes()[bytesRead:messageBoundary], message)
messageBytes := buffer.Bytes()[bytesRead:messageBoundary]
err := proto.Unmarshal(messageBytes, message)
if err != nil {
logger.Warnf("Failed to read proto message: %s\n", err.Error())
logger.Warnf("Message : %s\n", string(messageBytes))
} else {
switch message.MessageType {
case gauge_messages.Message_KillProcessRequest:
Expand Down

0 comments on commit 78a9400

Please sign in to comment.