Skip to content

Commit

Permalink
error message refined
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajan Joshi committed Feb 19, 2020
1 parent 5b365af commit 41f99c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions beater/pubsubbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ func getOrCreateSubscription(client *pubsub.Client, config *config.Config) (*pub
RetainAckedMessages: config.Subscription.RetainAckedMessages,
RetentionDuration: config.Subscription.RetentionDuration,
})

if st, ok := status.FromError(err); ok && st.Code() == codes.AlreadyExists {
st, ok := status.FromError(err)
if ok && st.Code() == codes.AlreadyExists {
// The subscription already exists.
subscription = client.Subscription(config.Subscription.Name)
} else if err != nil {
return nil, fmt.Errorf("project %q does not exists", err)
return nil, fmt.Errorf(st.Message())
} else if ok && st.Code() == codes.NotFound {
return nil, fmt.Errorf("topic %q does not exists", config.Topic)
} else if !ok {
Expand Down

0 comments on commit 41f99c6

Please sign in to comment.