google-cloud-cpp: Sample code and quickstarts should print full errors

Our sample/quickstart code only prints the error message, discarding the error code and error info. They look something like this (in the StatusOr<> case): https://github.com/googleapis/google-cloud-cpp/blob/08f1d4a76d92d79c8a5200a3c13e4453e8ad29a4/google/cloud/accessapproval/quickstart/quickstart.cc#L31

Printing the full error gives customers more information to debug issues they might encounter. Our sample/quickstart code should reflect the code we want our customers to write.

We can just make this public: https://github.com/googleapis/google-cloud-cpp/blob/08f1d4a76d92d79c8a5200a3c13e4453e8ad29a4/google/cloud/status.cc#L22-L26 … and do a tedious find and replace.

  • Fix examples/
  • Fix google/cloud/bigquery/samples/
  • Fix google/cloud/iam/samples/
  • Fix google/cloud/pubsub/samples/
  • Fix google/cloud/bigtable/examples/
  • Fix google/cloud/storage/examples/

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

How about throwing the whole Status value, and then just streaming it when caught?