Skip to content

Commit

Permalink
cmd/createtopic: better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
travisjeffery committed Sep 9, 2017
1 parent 4d12fcd commit 636eecc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/createtopic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func main() {

client := server.NewClient(conn)

_, err = client.CreateTopic("cmd/createtopic", &protocol.CreateTopicRequest{
resp, err := client.CreateTopic("cmd/createtopic", &protocol.CreateTopicRequest{
Topic: *topic,
NumPartitions: *partitions,
ReplicationFactor: int16(1),
Expand All @@ -42,5 +42,11 @@ func main() {
panic(err)
}

fmt.Println("created topic successfully")
for _, topicErrCode := range resp.TopicErrorCodes {
msg := "ok"
if topicErrCode.ErrorCode == 41 {
msg = "err not controller"
}
fmt.Printf("create topic %s: %d\n", topicErrCode.Topic, msg)
}
}

0 comments on commit 636eecc

Please sign in to comment.