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 Describes the cause of the error with structured details.

###### See Also

<https://cloud.google.com/apis/design/errors#error_info>

## Constructors

### ErrorInfo()

Default constructor.
Post-condition: the [`reason()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a9c68904d153cbec3d48191568939fcf4), [`domain()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a88e1355f82c33848c93660dc2759a816), and [`metadata()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a638bbabb8dc7cd51d5dda6db8cee5a16) fields are empty.

### ErrorInfo(std::string, std::string, std::unordered_map\< std::string, std::string \>)

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `reason` | `std::string` initializes the [`reason()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a9c68904d153cbec3d48191568939fcf4) value. |
| `domain` | `std::string` initializes the [`domain()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a88e1355f82c33848c93660dc2759a816) value. |
| `metadata` | `std::unordered_map< std::string, std::string >` initializes the [`metadata()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a638bbabb8dc7cd51d5dda6db8cee5a16) value. |

## Functions

### reason() const

The reason of the error.
This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.

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

### domain() const

The logical grouping to which the "reason" belongs.
The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com".

For errors generated by the C++ client libraries the domain is `gcloud-cpp`.

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

### metadata() const

Additional structured details about this error.
Keys should match the regular expression `[a-zA-Z0-9-_]` and be limited to 64 characters in length.

When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, if the client exceeds the number of instances that can be created in a single (batch) request return `{"instanceLimitPerRequest": "100"}` rather than `{"instanceLimit": "100/request"}`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `std::unordered_map< std::string, std::string > const &` |   |