This library never throws exceptions to signal error. In general, the library returns a StatusOr if an error is possible. Some functions return objects that are not wrapped in a StatusOr<T> but will themselves return a StatusOr<T> to signal an error. For example, wrappers for asynchronous operations return future<StatusOr<T>>.
Applications should check if the StatusOr<T> contains a value before using it, much like how you might check that a pointer is not null before dereferencing it. Indeed, a StatusOr<T> object can be used like a smart-pointer to T, with the main difference being that when it does not hold a T it will instead hold a Status object with extra information about the error.
You can check that a StatusOr<T> contains a value by calling the .ok() method, or by using operator bool() (like with other smart pointers). If there is no value, you can access the contained Status object using the .status() member. If there is a value, you may access it by dereferencing with operator*() or operator->(). As with all smart pointers, callers must first check that the StatusOr<T> contains a value before dereferencing and accessing the contained value. Alternatively, callers may instead use the .value() member function which is defined to throw a RuntimeStatusError if there is no value.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["\u003cp\u003eThe library uses \u003ccode\u003eStatusOr<T>\u003c/code\u003e to signal errors, and it never throws exceptions.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eStatusOr<T>\u003c/code\u003e should be checked using \u003ccode\u003e.ok()\u003c/code\u003e or \u003ccode\u003eoperator bool()\u003c/code\u003e to ensure it contains a value before dereferencing or using \u003ccode\u003e.value()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003e.status()\u003c/code\u003e member can be used to get the \u003ccode\u003eStatus\u003c/code\u003e object when \u003ccode\u003eStatusOr<T>\u003c/code\u003e does not have a value.\u003c/p\u003e\n"],["\u003cp\u003eThe documentation also references the handling of asynchronous operations, utilizing \u003ccode\u003efuture<StatusOr<T>>\u003c/code\u003e for error signaling.\u003c/p\u003e\n"],["\u003cp\u003eThis page also contains a list of all prior versions of the C++ BigTable library, from 2.37.0-rc down to 2.11.0.\u003c/p\u003e\n"]]],[],null,["Version 2.12.0keyboard_arrow_down\n\n- [2.42.0-rc (latest)](/cpp/docs/reference/bigtable/latest/bigtable-error-handling)\n- [2.41.0](/cpp/docs/reference/bigtable/2.41.0/bigtable-error-handling)\n- [2.40.0](/cpp/docs/reference/bigtable/2.40.0/bigtable-error-handling)\n- [2.39.0](/cpp/docs/reference/bigtable/2.39.0/bigtable-error-handling)\n- [2.38.0](/cpp/docs/reference/bigtable/2.38.0/bigtable-error-handling)\n- [2.37.0](/cpp/docs/reference/bigtable/2.37.0/bigtable-error-handling)\n- [2.36.0](/cpp/docs/reference/bigtable/2.36.0/bigtable-error-handling)\n- [2.35.0](/cpp/docs/reference/bigtable/2.35.0/bigtable-error-handling)\n- [2.34.0](/cpp/docs/reference/bigtable/2.34.0/bigtable-error-handling)\n- [2.33.0](/cpp/docs/reference/bigtable/2.33.0/bigtable-error-handling)\n- [2.32.0](/cpp/docs/reference/bigtable/2.32.0/bigtable-error-handling)\n- [2.31.0](/cpp/docs/reference/bigtable/2.31.0/bigtable-error-handling)\n- [2.30.0](/cpp/docs/reference/bigtable/2.30.0/bigtable-error-handling)\n- [2.29.0](/cpp/docs/reference/bigtable/2.29.0/bigtable-error-handling)\n- [2.28.0](/cpp/docs/reference/bigtable/2.28.0/bigtable-error-handling)\n- [2.27.0](/cpp/docs/reference/bigtable/2.27.0/bigtable-error-handling)\n- [2.26.0](/cpp/docs/reference/bigtable/2.26.0/bigtable-error-handling)\n- [2.25.1](/cpp/docs/reference/bigtable/2.25.1/bigtable-error-handling)\n- [2.24.0](/cpp/docs/reference/bigtable/2.24.0/bigtable-error-handling)\n- [2.23.0](/cpp/docs/reference/bigtable/2.23.0/bigtable-error-handling)\n- [2.22.1](/cpp/docs/reference/bigtable/2.22.1/bigtable-error-handling)\n- [2.21.0](/cpp/docs/reference/bigtable/2.21.0/bigtable-error-handling)\n- [2.20.0](/cpp/docs/reference/bigtable/2.20.0/bigtable-error-handling)\n- [2.19.0](/cpp/docs/reference/bigtable/2.19.0/bigtable-error-handling)\n- [2.18.0](/cpp/docs/reference/bigtable/2.18.0/bigtable-error-handling)\n- [2.17.0](/cpp/docs/reference/bigtable/2.17.0/bigtable-error-handling)\n- [2.16.0](/cpp/docs/reference/bigtable/2.16.0/bigtable-error-handling)\n- [2.15.1](/cpp/docs/reference/bigtable/2.15.1/bigtable-error-handling)\n- [2.14.0](/cpp/docs/reference/bigtable/2.14.0/bigtable-error-handling)\n- [2.13.0](/cpp/docs/reference/bigtable/2.13.0/bigtable-error-handling)\n- [2.12.0](/cpp/docs/reference/bigtable/2.12.0/bigtable-error-handling)\n- [2.11.0](/cpp/docs/reference/bigtable/2.11.0/bigtable-error-handling) \n\nError Handling\n==============\n\nThis library never throws exceptions to signal error. In general, the library returns a [StatusOr](https://cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1StatusOr.html) if an error is possible. Some functions return objects that are not wrapped in a `StatusOr\u003cT\u003e` but will themselves return a `StatusOr\u003cT\u003e` to signal an error. For example, wrappers for asynchronous operations return `future\u003cStatusOr\u003cT\u003e\u003e`.\n\nApplications should check if the `StatusOr\u003cT\u003e` contains a value before using it, much like how you might check that a pointer is not null before dereferencing it. Indeed, a `StatusOr\u003cT\u003e` object can be used like a smart-pointer to `T`, with the main difference being that when it does not hold a `T` it will instead hold a `Status` object with extra information about the error.\n\nYou can check that a `StatusOr\u003cT\u003e` contains a value by calling the `.ok()` method, or by using `operator bool()` (like with other smart pointers). If there is no value, you can access the contained `Status` object using the `.status()` member. If there is a value, you may access it by dereferencing with `operator*()` or `operator-\u003e()`. As with all smart pointers, callers must first check that the `StatusOr\u003cT\u003e` contains a value before dereferencing and accessing the contained value. Alternatively, callers may instead use the `.value()` member function which is defined to throw a [RuntimeStatusError](https://cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1RuntimeStatusError.html) if there is no value.\n| **Note:** If you're compiling with exceptions disabled, calling `.value()` on a `StatusOr\u003cT\u003e` that does not contain a value will terminate the program instead of throwing.\n\n###### Example\n\n namespace cbt = ::google::cloud::bigtable;\n using ::google::cloud::StatusOr;\n [](google::cloud::bigtable::Table table, std::string const& row_key) {\n StatusOr\u003cstd::pair\u003cbool, cbt::Row\u003e\u003e tuple = table.ReadRow(\n row_key, cbt::Filter::ColumnName(\"stats_summary\", \"os_build\"));\n if (!tuple) throw std::move(tuple).status();\n if (!tuple-\u003efirst) {\n std::cout \u003c\u003c \"Row \" \u003c\u003c row_key \u003c\u003c \" not found\\n\";\n return;\n }\n PrintRow(tuple-\u003esecond);\n }\n\n###### See Also\n\n[`google::cloud::StatusOr`](https://cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1StatusOr.html)\n\n###### See Also\n\n[`google::cloud::Status`](https://cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Status.html) the class used to describe errors.\n\n###### See Also\n\n[`google::cloud::future`](https://cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1future.html) for more details on the type returned by asynchronous operations."]]