#include <userver/ugrpc/rich_status.hpp>
Provides structured error information about the cause of an error.
Use this detail to provide a machine-readable error reason, domain, and additional metadata. This is useful for error handling logic on the client side.
Any request-specific information which contributes to the Status.message or LocalizedMessage.message messages must be represented within metadata. This practice is critical so that machine actors do not need to parse error messages to extract information.
Definition at line 107 of file rich_status.hpp.
Public Member Functions | |
| google::rpc::ErrorInfo | ToGoogleErrorDetail () const & |
| google::rpc::ErrorInfo | ToGoogleErrorDetail () && |
Static Public Member Functions | |
| static std::optional< ErrorInfo > | TryUnpack (const google::protobuf::Any &any) |
Public Attributes | |
| std::string | reason |
| The reason of the error (e.g., "INVALID_TOKEN", "SERVICE_DISABLED"). | |
| std::string | domain |
| The logical grouping to which the error belongs (e.g., "auth.example.com"). | |
| std::unordered_map< std::string, std::string > | metadata |
| Additional structured details about the error. | |
| std::string ugrpc::ErrorInfo::domain |
The logical grouping to which the error belongs (e.g., "auth.example.com").
Definition at line 117 of file rich_status.hpp.
| std::unordered_map<std::string, std::string> ugrpc::ErrorInfo::metadata |
Additional structured details about the error.
Definition at line 120 of file rich_status.hpp.
| std::string ugrpc::ErrorInfo::reason |
The reason of the error (e.g., "INVALID_TOKEN", "SERVICE_DISABLED").
The reason field is a short snake_case description of the cause of the error. Error reasons are unique within a particular domain of errors. The reason must be at most 63 characters and match a regular expression of [A-Z][A-Z0-9_]+[A-Z0-9]. (This is UPPER_SNAKE_CASE, without leading or trailing underscores, and without leading digits.)
Definition at line 114 of file rich_status.hpp.