43class RichStatus
final {
59 template <
typename... TDetails>
60 RichStatus(grpc::StatusCode code, std::string message, TDetails&&... details);
65 template <
typename TDetail>
78 template <
typename TRichErrorDetail>
79 [[nodiscard]]
static std::optional<TRichErrorDetail>
TryGetDetail(
const google::rpc::Status& status);
81 [[nodiscard]]
const google::rpc::Status& GetGoogleStatus()
const& {
return google_status_; }
82 google::rpc::Status GetGoogleStatus() && {
return std::move(google_status_); }
88 [[nodiscard]]
explicit operator grpc::Status()
const {
return ToGrpcStatus(); }
91 google::rpc::Status google_status_;
391std::optional<TRichErrorDetail> RichStatus::
TryGetDetail(
const google::rpc::Status& status) {
392 for (
const auto& detail : status.details()) {
393 const auto rich_error_detail_opt = TRichErrorDetail::TryUnpack(detail);
394 if (rich_error_detail_opt) {
395 return *rich_error_detail_opt;