userver: ugrpc::LocalizedMessage Struct Reference
Loading...
Searching...
No Matches
ugrpc::LocalizedMessage Struct Reference

#include <userver/ugrpc/rich_status.hpp>

Detailed Description

Provides a localized error message that is safe to return to the user.

See also
https://google.aip.dev/193
https:///github.com/googleapis/googleapis/blob/master/google/rpc/error_details.proto
ugrpc::RichStatus

Provides a localized error message that is safe to return to the user which can be attached to an RPC error.

The LocalizedMessage payload should contain the complete resolution to the error. If more information is needed than can reasonably fit in this payload, then additional resolution information must be provided in a Help payload.

Example usage:

grpc::StatusCode::INVALID_ARGUMENT,
"Invalid email address",
"ru-RU",
"Неверный формат электронной почты. Пожалуйста, используйте name@example.com",
},
};

Definition at line 357 of file rich_status.hpp.

Public Member Functions

google::rpc::LocalizedMessage ToGoogleErrorDetail () const &
 
google::rpc::LocalizedMessage ToGoogleErrorDetail () &&
 

Static Public Member Functions

static std::optional< LocalizedMessageTryUnpack (const google::protobuf::Any &any)
 

Public Attributes

std::string locale
 The locale (e.g., "en-US", "ru-RU", "ja-JP").
 
std::string message
 The localized error message.
 

Member Data Documentation

◆ locale

std::string ugrpc::LocalizedMessage::locale

The locale (e.g., "en-US", "ru-RU", "ja-JP").

Definition at line 359 of file rich_status.hpp.

◆ message

std::string ugrpc::LocalizedMessage::message

The localized error message.

This should include a brief description of the error and a call to action to resolve the error. The message should include contextual information to make the message as specific as possible. Any contextual information in the message must be included in ErrorInfo::metadata.

Definition at line 366 of file rich_status.hpp.


The documentation for this struct was generated from the following file: