Skip to content

Commit

Permalink
[executor] Prevent crash on bad incoming message
Browse files Browse the repository at this point in the history
  • Loading branch information
teo committed Oct 6, 2023
1 parent d44acea commit 5835229
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions executor/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,17 @@ func handleMessageEvent(state *internalState, data []byte) (err error) {
var cmd *executorcmd.ExecutorCommand_Transition
cmd, err = activeTask.UnmarshalTransition(data)
if err != nil {
log.WithFields(logrus.Fields{
"name": cmd.Name,
"message": string(data[:]),
"error": err.Error(),
}).
fields := logrus.Fields{
"error": err.Error(),
}
if cmd != nil {
fields["name"] = cmd.Name
}
if len(data) > 0 {
fields["message"] = string(data[:])
}

log.WithFields(fields).
Error("cannot unmarshal incoming MESSAGE")
return
}
Expand Down

0 comments on commit 5835229

Please sign in to comment.