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"}.
[[["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\u003eThis page provides documentation for the \u003ccode\u003eErrorInfo\u003c/code\u003e class within the Google Cloud C++ client libraries, outlining its purpose in describing error causes with structured details.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eErrorInfo\u003c/code\u003e class has a default constructor that leaves the \u003ccode\u003ereason()\u003c/code\u003e, \u003ccode\u003edomain()\u003c/code\u003e, and \u003ccode\u003emetadata()\u003c/code\u003e fields empty, and another constructor that initializes these with user provided values.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ereason()\u003c/code\u003e function retrieves the specific cause of the error, presented in UPPER_SNAKE_CASE and unique within its error domain.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003edomain()\u003c/code\u003e function identifies the logical grouping or service associated with the error, such as \u003ccode\u003e"pubsub.googleapis.com"\u003c/code\u003e or \u003ccode\u003e"gcloud-cpp"\u003c/code\u003e for C++ client library errors.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003emetadata()\u003c/code\u003e function provides access to additional details about the error, stored as key-value pairs where keys are limited to 64 characters and adhere to a specified regular expression.\u003c/p\u003e\n"]]],[],null,[]]