Skip to content

Commit

Permalink
add error handling for the SubscribeTopics function call
Browse files Browse the repository at this point in the history
  • Loading branch information
HamzaRahmani committed May 28, 2024
1 parent b2b9f94 commit 6c6fa0e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func main() {
}

err = c.SubscribeTopics(topics, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to subscribe to topics: %v\n", err)
os.Exit(1)
}

run := true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func main() {
}

err = c.SubscribeTopics(topics, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to subscribe to topics: %v\n", err)
os.Exit(1)
}

run := true

Expand Down
4 changes: 4 additions & 0 deletions examples/consumer_example/consumer_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func main() {
fmt.Printf("Created Consumer %v\n", c)

err = c.SubscribeTopics(topics, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to subscribe to topics: %v\n", err)
os.Exit(1)
}

run := true

Expand Down
4 changes: 4 additions & 0 deletions examples/json_consumer_example/json_consumer_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ func main() {
}

err = c.SubscribeTopics(topics, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to subscribe to topics: %v\n", err)
os.Exit(1)
}

run := true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func main() {
deser.ProtoRegistry.RegisterMessage((&User{}).ProtoReflect().Type())

err = c.SubscribeTopics(topics, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to subscribe to topics: %v\n", err)
os.Exit(1)
}

run := true

Expand Down
4 changes: 4 additions & 0 deletions examples/stats_example/stats_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func main() {
fmt.Printf("Created Consumer %v\n", c)

err = c.SubscribeTopics(topics, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to subscribe to topics: %v\n", err)
os.Exit(1)
}

run := true

Expand Down

0 comments on commit 6c6fa0e

Please sign in to comment.