41class RichStatus
final {
57 template <
typename... TDetails>
58 RichStatus(grpc::StatusCode code, std::string message, TDetails&&... details);
63 template <
typename TDetail>
76 template <
typename TRichErrorDetail>
77 [[nodiscard]]
static std::optional<TRichErrorDetail>
TryGetDetail(
const google::rpc::Status& status);
79 [[nodiscard]]
const google::rpc::Status& GetGoogleStatus()
const& {
return google_status_; }
80 google::rpc::Status GetGoogleStatus() && {
return std::move(google_status_); }
86 [[nodiscard]]
explicit operator grpc::Status()
const {
return ToGrpcStatus(); }
89 google::rpc::Status google_status_;
389std::optional<TRichErrorDetail> RichStatus::
TryGetDetail(
const google::rpc::Status& status) {
390 for (
const auto& detail : status.details()) {
391 const auto rich_error_detail_opt = TRichErrorDetail::TryUnpack(detail);
392 if (rich_error_detail_opt) {
393 return *rich_error_detail_opt;