3.11.0-rc 3.10.0 (latest) 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.0 2.48.0-rc 2.47.1 2.46.0 2.45.0 2.44.0 2.43.0 2.42.0 2.41.0 2.40.0 2.39.0 2.38.0 2.37.0 2.36.0 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.0 2.28.0 2.27.0 2.26.0 2.25.1 2.24.0 2.23.0 2.22.1 2.21.0 2.20.0 2.19.0 2.18.0 2.17.0 2.16.0 2.15.1 2.14.0 2.13.0 2.12.0 2.11.0 2.10.1 Represents success or an error with info about the error.
This class is typically used to indicate whether or not a function or other operation completed successfully. Success is indicated by an "OK" status. OK statuses will have `.`[`code()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Status#classgoogle_1_1cloud_1_1Status_1ac18337d2ceb00ca007725d21f2c63f9f)`==`[`StatusCode::kOk`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847#namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847ae69fa9a656f76dd8a4d89f21992b2d3a) and `.`[`ok()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Status#classgoogle_1_1cloud_1_1Status_1a18952043ffe5a4f74911c8146e8bb504)`== true`, with all other properties having empty values. All OK statuses are equal. Any non-OK [`Status`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Status) is considered an error. Users can inspect the error using the member functions, or they can simply stream the [`Status`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Status) object, and it will print itself in some human readable way (the streamed format may change over time and you should *not* depend on the specific format of a streamed [`Status`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Status) object remaining unchanged).

This is a regular value type that can be copied, moved, compared for equality, and streamed.

## Constructors

### Status(Status const \&)

Copy construction and assignment.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
|   | `Status const &` |

### Status(Status \&\&)

Move construction and assignment.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
|   | `Status &&` |

### Status()

Default constructor, initializes to [`StatusCode::kOk`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847#namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847ae69fa9a656f76dd8a4d89f21992b2d3a).

### Status(StatusCode, std::string, ErrorInfo)

Construct from a status code, message and (optional) error info.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `code` | `StatusCode` the status code for the new [`Status`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Status). |
| `message` | `std::string` the message for the new [`Status`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Status), ignored if `code` is [`StatusCode::kOk`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847#namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847ae69fa9a656f76dd8a4d89f21992b2d3a). |
| `info` | `ErrorInfo` the [`ErrorInfo`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ErrorInfo) for the new [`Status`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Status), ignored if `code` is [`StatusCode::kOk`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847#namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847ae69fa9a656f76dd8a4d89f21992b2d3a). |

## Operators

### operator=(Status const \&)

Copy construction and assignment.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
|   | `Status const &` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Status &` |   |

### operator=(Status \&\&)

Move construction and assignment.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
|   | `Status &&` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Status &` |   |

## Functions

### ok() const

Returns true if the status code is [`StatusCode::kOk`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847#namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847ae69fa9a656f76dd8a4d89f21992b2d3a).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### code() const

Returns the status code.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `StatusCode` |   |

### message() const

Returns the message associated with the status.
This is always empty if [`code()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Status#classgoogle_1_1cloud_1_1Status_1ac18337d2ceb00ca007725d21f2c63f9f) is [`StatusCode::kOk`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847#namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847ae69fa9a656f76dd8a4d89f21992b2d3a).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `std::string const &` |   |

### error_info() const

Returns the additional error info associated with the status.
This is always a default-constructed error info if [`code()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Status#classgoogle_1_1cloud_1_1Status_1ac18337d2ceb00ca007725d21f2c63f9f) is [`StatusCode::kOk`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847#namespacegoogle_1_1cloud_1a90e17f75452470f0f3ee1a06ffe58847ae69fa9a656f76dd8a4d89f21992b2d3a).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ErrorInfo const &` |   |