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 isgcloud-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"}.
[[["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\u003eThis page provides documentation for the \u003ccode\u003eErrorInfo\u003c/code\u003e class in the Google Cloud C++ client library, used to describe the cause of an error.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eErrorInfo\u003c/code\u003e class can be constructed with a reason, a domain, and metadata, or it can be default-constructed with empty fields for reason, domain, and metadata.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the documentation for \u003ccode\u003eErrorInfo\u003c/code\u003e is version 2.37.0-rc, but many older versions, down to 2.10.1, are also documented and accessible.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eErrorInfo\u003c/code\u003e class includes functions to access the error's reason (a constant string in UPPER_SNAKE_CASE), domain (typically the service name or \u003ccode\u003egcloud-cpp\u003c/code\u003e for C++ client library errors), and metadata (key-value pairs with additional details).\u003c/p\u003e\n"],["\u003cp\u003eThe class adheres to guidelines established in the Google API design errors, and the error information helps identify errors and their causes.\u003c/p\u003e\n"]]],[],null,["# Class ErrorInfo (2.36.0)\n\nVersion 2.36.0keyboard_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\n\n\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.36.0/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a9c68904d153cbec3d48191568939fcf4), [`domain()`](/cpp/docs/reference/common/2.36.0/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a88e1355f82c33848c93660dc2759a816), and [`metadata()`](/cpp/docs/reference/common/2.36.0/classgoogle_1_1cloud_1_1ErrorInfo#classgoogle_1_1cloud_1_1ErrorInfo_1a638bbabb8dc7cd51d5dda6db8cee5a16) fields are empty.\n\n### ErrorInfo(std::string, std::string, std::unordered_map\\\u003c std::string, std::string \\\u003e)\n\nConstructor.\n\nFunctions\n---------\n\n### reason() const\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() const\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() const\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\"}`."]]