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
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 isgcloud-cpp.
Returns
Type
Description
std::string const &
metadata
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"}.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eErrorInfo\u003c/code\u003e class provides structured details about the cause of an error, including a reason, domain, and metadata.\u003c/p\u003e\n"],["\u003cp\u003eThere are multiple versions available, ranging from 2.10.1 to the latest release candidate 2.37.0-rc, with direct links to documentation for each.\u003c/p\u003e\n"],["\u003cp\u003eConstructors for \u003ccode\u003eErrorInfo\u003c/code\u003e allow for default initialization or specification of reason, domain, and metadata.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ereason\u003c/code\u003e function provides a constant string that identifies the specific cause of the error, formatted in UPPER_SNAKE_CASE, while the \u003ccode\u003edomain\u003c/code\u003e function gives the logical group to which the reason belongs.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003emetadata\u003c/code\u003e function provides additional structured details as key-value pairs in an unordered map, with keys following specific formatting and length requirements.\u003c/p\u003e\n"]]],[],null,["# Class google::cloud::ErrorInfo (2.10.1)\n\nVersion 2.10.1keyboard_arrow_down\n\n- [2.42.0-rc (latest)](/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.41.0](/cpp/docs/reference/common/2.41.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.40.0](/cpp/docs/reference/common/2.40.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.39.0](/cpp/docs/reference/common/2.39.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.38.0](/cpp/docs/reference/common/2.38.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.37.0](/cpp/docs/reference/common/2.37.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.36.0](/cpp/docs/reference/common/2.36.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.35.0](/cpp/docs/reference/common/2.35.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.34.0](/cpp/docs/reference/common/2.34.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.33.0](/cpp/docs/reference/common/2.33.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.32.0](/cpp/docs/reference/common/2.32.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.31.0](/cpp/docs/reference/common/2.31.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.30.0](/cpp/docs/reference/common/2.30.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.29.0](/cpp/docs/reference/common/2.29.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.28.0](/cpp/docs/reference/common/2.28.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.27.0](/cpp/docs/reference/common/2.27.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.26.0](/cpp/docs/reference/common/2.26.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.25.1](/cpp/docs/reference/common/2.25.1/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.24.0](/cpp/docs/reference/common/2.24.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.23.0](/cpp/docs/reference/common/2.23.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.22.1](/cpp/docs/reference/common/2.22.1/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.21.0](/cpp/docs/reference/common/2.21.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.20.0](/cpp/docs/reference/common/2.20.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.19.0](/cpp/docs/reference/common/2.19.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.18.0](/cpp/docs/reference/common/2.18.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.17.0](/cpp/docs/reference/common/2.17.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.16.0](/cpp/docs/reference/common/2.16.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.15.1](/cpp/docs/reference/common/2.15.1/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.14.0](/cpp/docs/reference/common/2.14.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.13.0](/cpp/docs/reference/common/2.13.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.12.0](/cpp/docs/reference/common/2.12.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.11.0](/cpp/docs/reference/common/2.11.0/classgoogle_1_1cloud_1_1ErrorInfo)\n- [2.10.1](/cpp/docs/reference/common/2.10.1/classgoogle_1_1cloud_1_1ErrorInfo) \nDescribes the cause of the error with structured details. \n\n###### See Also\u003chttps://cloud.google.com/apis/design/errors#error_info\u003e\n\nConstructors\n------------\n\n### ErrorInfo\n\nDefault constructor. \nPost-condition: the [`reason()`](/cpp/docs/reference/common/2.10.1/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a9c68904d153cbec3d48191568939fcf4), [`domain()`](/cpp/docs/reference/common/2.10.1/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a88e1355f82c33848c93660dc2759a816), and [`metadata()`](/cpp/docs/reference/common/2.10.1/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a638bbabb8dc7cd51d5dda6db8cee5a16) fields are empty.\n\n### ErrorInfo\n\nConstructor.\n\nFunctions\n---------\n\n### reason\n\nThe reason of the error. \nThis 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.\n\n### domain\n\nThe logical grouping to which the \"reason\" belongs. \nThe 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\".\n\nFor errors generated by the C++ client libraries the domain is `gcloud-cpp`.\n\n### metadata\n\nAdditional structured details about this error. \nKeys should match the regular expression `[a-zA-Z0-9-_]` and be limited to 64 characters in length.\n\nWhen 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\"}`."]]