Skip to content

Commit

Permalink
move sub
Browse files Browse the repository at this point in the history
  • Loading branch information
alevenberg committed Jul 18, 2023
1 parent f254c19 commit f20cc53
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions google/cloud/pubsub/samples/samples.cc
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,13 @@ void CreateBigQuerySubscription(
pubsub::Subscription(project_id, std::move(subscription_id)),
pubsub::SubscriptionBuilder{}.set_bigquery_config(
pubsub::BigQueryConfigBuilder{}.set_table(table_id)));
if (sub.status().code() == google::cloud::StatusCode::kAlreadyExists) {
std::cout << "The subscription already exists\n";
return;
if (!sub) {
if (sub.status().code() == google::cloud::StatusCode::kAlreadyExists) {
std::cout << "The subscription already exists\n";
return;
}
throw std::move(sub).status();
}
if (!sub) throw std::move(sub).status();

std::cout << "The subscription was successfully created: "
<< sub->DebugString() << "\n";
Expand Down

0 comments on commit f20cc53

Please # to comment.