Skip to content

Commit

Permalink
Merge pull request #21 from jeroenrinzema/v0.3.1-rc
Browse files Browse the repository at this point in the history
fix: check if err is nil
  • Loading branch information
jeroenrinzema authored Aug 21, 2019
2 parents 030fd4d + 199cac2 commit 3bb9cb0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ func (writer *writer) ErrorEOS(action string, status types.StatusCode, err error
status = types.StatusInternalServerError
}

message := writer.NewMessage(action, 0, nil, []byte(err.Error()))
var payload []byte
if err != nil {
payload = []byte(err.Error())
}

message := writer.NewMessage(action, 0, nil, payload)
message.Status = status
message.EOS = true

Expand All @@ -90,7 +95,12 @@ func (writer *writer) ErrorStream(action string, status types.StatusCode, err er
status = types.StatusInternalServerError
}

message := writer.NewMessage(action, 0, nil, []byte(err.Error()))
var payload []byte
if err != nil {
payload = []byte(err.Error())
}

message := writer.NewMessage(action, 0, nil, payload)
message.Status = status

err = writer.group.ProduceEvent(message)
Expand Down

0 comments on commit 3bb9cb0

Please # to comment.