Skip to content

Commit

Permalink
Merge pull request #338 from nats-io/no_panic_on_unmarshal_error
Browse files Browse the repository at this point in the history
[FIXED] No panic on protobuf Unmarshal errors
  • Loading branch information
kozlovic authored Jan 8, 2021
2 parents 22aa6ac + a4f322d commit 299fe0f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
24 changes: 12 additions & 12 deletions pb/protocol.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions stan.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,8 @@ func (sc *conn) processAck(m *nats.Msg) {
pa := &pb.PubAck{}
err := pa.Unmarshal(m.Data)
if err != nil {
panic(fmt.Errorf("error during ack unmarshal: %v", err))
fmt.Printf("error during ack unmarshal: %v\n", err)
return
}

// Remove
Expand Down Expand Up @@ -846,7 +847,8 @@ func (sc *conn) processMsg(raw *nats.Msg) {
msg := &Msg{}
err := msg.Unmarshal(raw.Data)
if err != nil {
panic(fmt.Errorf("error processing unmarshal for msg: %v", err))
fmt.Printf("error during message unmarshal: %v\n", err)
return
}
var sub *subscription
// Lookup the subscription
Expand Down

0 comments on commit 299fe0f

Please sign in to comment.