diff options
author | babenko <babenko@yandex-team.com> | 2025-02-22 17:28:25 +0300 |
---|---|---|
committer | babenko <babenko@yandex-team.com> | 2025-02-22 17:48:29 +0300 |
commit | 59afaa0cb7cd89146dd10f5446256afcce33bd0e (patch) | |
tree | 38d3c46bcba8da7c3b8ffc6b818695bc6b62d532 /library/cpp/yt/error | |
parent | 1d9cc117e33b162a5247032e175ed7ea26971437 (diff) | |
download | ydb-59afaa0cb7cd89146dd10f5446256afcce33bd0e.tar.gz |
YT-22593: More trivial TString->std::string migrations
[nodiff:runtime]
commit_hash:1ba799aed1703ab7c6304b6da7090b3337f768dd
Diffstat (limited to 'library/cpp/yt/error')
-rw-r--r-- | library/cpp/yt/error/error-inl.h | 6 | ||||
-rw-r--r-- | library/cpp/yt/error/error.cpp | 33 | ||||
-rw-r--r-- | library/cpp/yt/error/error.h | 12 | ||||
-rw-r--r-- | library/cpp/yt/error/error_attributes-inl.h | 3 | ||||
-rw-r--r-- | library/cpp/yt/error/error_attributes.h | 2 | ||||
-rw-r--r-- | library/cpp/yt/error/error_code.cpp | 16 | ||||
-rw-r--r-- | library/cpp/yt/error/error_code.h | 12 | ||||
-rw-r--r-- | library/cpp/yt/error/origin_attributes.cpp | 4 | ||||
-rw-r--r-- | library/cpp/yt/error/origin_attributes.h | 2 | ||||
-rw-r--r-- | library/cpp/yt/error/text_yson.cpp | 12 | ||||
-rw-r--r-- | library/cpp/yt/error/unittests/error_code_ut.cpp | 4 | ||||
-rw-r--r-- | library/cpp/yt/error/unittests/error_ut.cpp | 38 |
12 files changed, 72 insertions, 72 deletions
diff --git a/library/cpp/yt/error/error-inl.h b/library/cpp/yt/error/error-inl.h index f82b8eb20d..6329528f02 100644 --- a/library/cpp/yt/error/error-inl.h +++ b/library/cpp/yt/error/error-inl.h @@ -55,14 +55,14 @@ constexpr bool TErrorCode::operator == (TErrorCode rhs) const namespace NDetail { template <class... TArgs> -TString FormatErrorMessage(TStringBuf format, TArgs&&... args) +std::string FormatErrorMessage(TStringBuf format, TArgs&&... args) { return Format(TRuntimeFormat{format}, std::forward<TArgs>(args)...); } -inline TString FormatErrorMessage(TStringBuf format) +inline std::string FormatErrorMessage(TStringBuf format) { - return TString(format); + return std::string(format); } } // namespace NDetail diff --git a/library/cpp/yt/error/error.cpp b/library/cpp/yt/error/error.cpp index 4790fbf606..636d7d81fc 100644 --- a/library/cpp/yt/error/error.cpp +++ b/library/cpp/yt/error/error.cpp @@ -46,14 +46,14 @@ public: , InnerErrors_(other.InnerErrors_) { } - explicit TImpl(TString message) + explicit TImpl(std::string message) : Code_(NYT::EErrorCode::Generic) , Message_(std::move(message)) { OriginAttributes_.Capture(); } - TImpl(TErrorCode code, TString message) + TImpl(TErrorCode code, std::string message) : Code_(code) , Message_(std::move(message)) { @@ -77,12 +77,12 @@ public: Code_ = code; } - const TString& GetMessage() const noexcept + const std::string& GetMessage() const noexcept { return Message_; } - TString* MutableMessage() noexcept + std::string* MutableMessage() noexcept { return &Message_; } @@ -164,7 +164,7 @@ public: private: TErrorCode Code_; - TString Message_; + std::string Message_; TOriginAttributes OriginAttributes_{ .Pid = 0, @@ -277,11 +277,11 @@ TError::TErrorOr(const std::exception& ex) YT_VERIFY(!IsOK()); } -TError::TErrorOr(TString message, TDisableFormat) +TError::TErrorOr(std::string message, TDisableFormat) : Impl_(std::make_unique<TImpl>(std::move(message))) { } -TError::TErrorOr(TErrorCode code, TString message, TDisableFormat) +TError::TErrorOr(TErrorCode code, std::string message, TDisableFormat) : Impl_(std::make_unique<TImpl>(code, std::move(message))) { } @@ -363,16 +363,16 @@ THashSet<TErrorCode> TError::GetDistinctNonTrivialErrorCodes() const return result; } -const TString& TError::GetMessage() const +const std::string& TError::GetMessage() const { if (!Impl_) { - static const TString Result; + static const std::string Result; return Result; } return Impl_->GetMessage(); } -TError& TError::SetMessage(TString message) +TError& TError::SetMessage(std::string message) { MakeMutable(); *Impl_->MutableMessage() = std::move(message); @@ -422,7 +422,7 @@ NThreading::TThreadId TError::GetTid() const TStringBuf TError::GetThreadName() const { if (!Impl_) { - static TString empty; + static std::string empty; return empty; } return Impl_->GetThreadName(); @@ -482,7 +482,7 @@ void TError::UpdateOriginAttributes() Impl_->UpdateOriginAttributes(); } -const TString InnerErrorsTruncatedKey("inner_errors_truncated"); +const std::string InnerErrorsTruncatedKey("inner_errors_truncated"); TError TError::Truncate( int maxInnerErrorCount, @@ -513,8 +513,7 @@ TError TError::Truncate( auto result = std::make_unique<TImpl>(); result->SetCode(GetCode()); - *result->MutableMessage() - = std::move(TruncateString(GetMessage(), stringLimit, ErrorMessageTruncatedSuffix)); + *result->MutableMessage() = TruncateString(GetMessage(), stringLimit, ErrorMessageTruncatedSuffix); if (Impl_->HasAttributes()) { truncateAttributes(Impl_->Attributes(), result->MutableAttributes()); } @@ -608,13 +607,13 @@ TError TError::Wrap() && return std::move(*this); } -Y_WEAK TString GetErrorSkeleton(const TError& /*error*/) +Y_WEAK std::string GetErrorSkeleton(const TError& /*error*/) { // Proper implementation resides in yt/yt/library/error_skeleton/skeleton.cpp. THROW_ERROR_EXCEPTION("Error skeleton implementation library is not linked; consider PEERDIR'ing yt/yt/library/error_skeleton"); } -TString TError::GetSkeleton() const +std::string TError::GetSkeleton() const { return GetErrorSkeleton(*this); } @@ -775,7 +774,7 @@ void AppendError(TStringBuilderBase* builder, const TError& error, int indent) AppendAttribute( builder, "host", - TString{originAttributes->Host}, + std::string{originAttributes->Host}, indent); } diff --git a/library/cpp/yt/error/error.h b/library/cpp/yt/error/error.h index beb097afe2..8b459d0beb 100644 --- a/library/cpp/yt/error/error.h +++ b/library/cpp/yt/error/error.h @@ -83,8 +83,8 @@ public: { }; static constexpr TDisableFormat DisableFormat = {}; - TErrorOr(TString message, TDisableFormat); - TErrorOr(TErrorCode code, TString message, TDisableFormat); + TErrorOr(std::string message, TDisableFormat); + TErrorOr(TErrorCode code, std::string message, TDisableFormat); template <class... TArgs> explicit TErrorOr( @@ -110,8 +110,8 @@ public: TErrorCode GetNonTrivialCode() const; THashSet<TErrorCode> GetDistinctNonTrivialErrorCodes() const; - const TString& GetMessage() const; - TError& SetMessage(TString message); + const std::string& GetMessage() const; + TError& SetMessage(std::string message); bool HasOriginAttributes() const; TProcessId GetPid() const; @@ -197,7 +197,7 @@ public: //! In order to prevent core -> re2 dependency, implementation belongs to a separate library //! yt/yt/library/error_skeleton. Calling this method without PEERDIR'ing implementation //! results in an exception. - TString GetSkeleton() const; + std::string GetSkeleton() const; TError& operator <<= (const TErrorAttribute& attribute) &; TError& operator <<= (const std::vector<TErrorAttribute>& attributes) &; @@ -281,7 +281,7 @@ public: const char* what() const noexcept override; private: - mutable TString CachedWhat_; + mutable std::string CachedWhat_; }; // Make these templates to avoid type erasure during throw. diff --git a/library/cpp/yt/error/error_attributes-inl.h b/library/cpp/yt/error/error_attributes-inl.h index 399c0792d4..310ededd02 100644 --- a/library/cpp/yt/error/error_attributes-inl.h +++ b/library/cpp/yt/error/error_attributes-inl.h @@ -55,8 +55,7 @@ template <class T> requires CConvertibleFromAttributeValue<T> T TErrorAttributes::GetAndRemove(const TKey& key, const T& defaultValue) { - auto value = Find<T>(key); - if (value) { + if (auto value = Find<T>(key)) { Remove(key); return *value; } else { diff --git a/library/cpp/yt/error/error_attributes.h b/library/cpp/yt/error/error_attributes.h index 8ab6388ef3..0ab0687dac 100644 --- a/library/cpp/yt/error/error_attributes.h +++ b/library/cpp/yt/error/error_attributes.h @@ -10,7 +10,7 @@ namespace NYT { //////////////////////////////////////////////////////////////////////////////// // TODO(arkady-e1ppa): Try switching to TString/std::string eventually. -// representing text-encoded yson string eventually (maybe). +// representing text-encoded YSON string eventually (maybe). class TErrorAttributes { public: diff --git a/library/cpp/yt/error/error_code.cpp b/library/cpp/yt/error/error_code.cpp index 9cb0d57dc2..d82d03214d 100644 --- a/library/cpp/yt/error/error_code.cpp +++ b/library/cpp/yt/error/error_code.cpp @@ -85,7 +85,7 @@ bool TErrorCodeRegistry::TErrorCodeRangeInfo::Contains(int value) const return From <= value && value <= To; } -void TErrorCodeRegistry::RegisterErrorCodeRange(int from, int to, TString namespaceName, std::function<TString(int)> formatter) +void TErrorCodeRegistry::RegisterErrorCodeRange(int from, int to, std::string namespaceName, std::function<std::string(int)> formatter) { YT_VERIFY(from <= to); @@ -117,24 +117,26 @@ void TErrorCodeRegistry::CheckCodesAgainstRanges() const } } -TString TErrorCodeRegistry::ParseNamespace(const std::type_info& errorCodeEnumTypeInfo) +std::string TErrorCodeRegistry::ParseNamespace(const std::type_info& errorCodeEnumTypeInfo) { - TString name; + std::string name; // Ensures that "EErrorCode" is found as a substring in the type name and stores the prefix before // the first occurrence into #name. YT_VERIFY(StringSplitter( TypeName(errorCodeEnumTypeInfo)).SplitByString("EErrorCode").Limit(2).TryCollectInto(&name, &std::ignore)); // TypeName returns name in form "enum ErrorCode" on Windows - if (name.StartsWith("enum ")) { - name.remove(0, 5); + constexpr TStringBuf enumPrefix = "enum "; + if (name.starts_with(enumPrefix)) { + name.erase(0, enumPrefix.size()); } // If the enum was declared directly in the global namespace, #name should be empty. // Otherwise, #name should end with "::". + constexpr TStringBuf namespaceSeparator = "::"; if (!name.empty()) { - YT_VERIFY(name.EndsWith("::")); - name.resize(name.size() - 2); + YT_VERIFY(name.ends_with(namespaceSeparator)); + name.resize(name.size() - namespaceSeparator.size()); } return name; } diff --git a/library/cpp/yt/error/error_code.h b/library/cpp/yt/error/error_code.h index 1c2c08fbb4..fe1a25c3c3 100644 --- a/library/cpp/yt/error/error_code.h +++ b/library/cpp/yt/error/error_code.h @@ -19,9 +19,9 @@ public: struct TErrorCodeInfo { - TString Namespace; + std::string Namespace; //! Human-readable error code name. - TString Name; + std::string Name; bool operator==(const TErrorCodeInfo& rhs) const; }; @@ -30,8 +30,8 @@ public: { int From; int To; - TString Namespace; - std::function<TString(int code)> Formatter; + std::string Namespace; + std::function<std::string(int code)> Formatter; TErrorCodeInfo Get(int code) const; bool Intersects(const TErrorCodeRangeInfo& other) const; @@ -51,9 +51,9 @@ public: void RegisterErrorCode(int code, const TErrorCodeInfo& errorCodeInfo); //! Registers a range of error codes given a human-readable code to name formatter. - void RegisterErrorCodeRange(int from, int to, TString namespaceName, std::function<TString(int code)> formatter); + void RegisterErrorCodeRange(int from, int to, std::string namespaceName, std::function<std::string(int code)> formatter); - static TString ParseNamespace(const std::type_info& errorCodeEnumTypeInfo); + static std::string ParseNamespace(const std::type_info& errorCodeEnumTypeInfo); private: THashMap<int, TErrorCodeInfo> CodeToInfo_; diff --git a/library/cpp/yt/error/origin_attributes.cpp b/library/cpp/yt/error/origin_attributes.cpp index 2abb060ce2..69569762c4 100644 --- a/library/cpp/yt/error/origin_attributes.cpp +++ b/library/cpp/yt/error/origin_attributes.cpp @@ -84,7 +84,7 @@ std::optional<TOriginAttributes::TErasedExtensionData> GetExtensionData() return std::nullopt; } -TString FormatOrigin(const TOriginAttributes& attributes) +std::string FormatOrigin(const TOriginAttributes& attributes) { using TFunctor = TString(*)(const TOriginAttributes&); @@ -142,7 +142,7 @@ TOriginAttributes ExtractFromDictionaryDefault(TErrorAttributes* attributes) result.Tid = attributes->GetAndRemove(TidKey, NThreading::InvalidThreadId); static const std::string ThreadNameKey("thread"); - result.ThreadName = TString(attributes->GetAndRemove(ThreadNameKey, std::string())); + result.ThreadName = {attributes->GetAndRemove(ThreadNameKey, std::string())}; return result; } diff --git a/library/cpp/yt/error/origin_attributes.h b/library/cpp/yt/error/origin_attributes.h index e25eb37ea7..7d35446318 100644 --- a/library/cpp/yt/error/origin_attributes.h +++ b/library/cpp/yt/error/origin_attributes.h @@ -76,7 +76,7 @@ inline constexpr NGlobal::TVariableTag ExtractFromDictionaryTag = {}; // NB(arkady-e1ppa): ExtractFromDictionary symbol is left in yt/yt/core/misc/origin_attributes // because it depends on ytree for now. std::optional<TOriginAttributes::TErasedExtensionData> GetExtensionData(); -TString FormatOrigin(const TOriginAttributes& attributes); +std::string FormatOrigin(const TOriginAttributes& attributes); //////////////////////////////////////////////////////////////////////////////// diff --git a/library/cpp/yt/error/text_yson.cpp b/library/cpp/yt/error/text_yson.cpp index 42ad52bbcc..698c2fd244 100644 --- a/library/cpp/yt/error/text_yson.cpp +++ b/library/cpp/yt/error/text_yson.cpp @@ -137,7 +137,7 @@ std::string ConvertToTextYsonString<double>(const double& value) "%v%v", str, MakeFormatterWrapper([&] (TStringBuilderBase* builder) { - if (str.find('.') == TString::npos && str.find('e') == TString::npos && std::isfinite(value)) { + if (str.find('.') == std::string::npos && str.find('e') == std::string::npos && std::isfinite(value)) { builder->AppendChar('.'); } })); @@ -233,13 +233,13 @@ TSomeInt ParseSomeIntFromTextYsonString(TStringBuf strBuf) //////////////////////////////////////////////////////////////////////////////// -TString DoParseStringFromTextYson(TStringBuf strBuf) +std::string DoParseStringFromTextYson(TStringBuf strBuf) { // Remove quotation marks. return ::UnescapeC(TStringBuf{strBuf.data() + 1, strBuf.length() - 2}); } -TString ParseStringFromTextYsonString(TStringBuf strBuf) +std::string ParseStringFromTextYsonString(TStringBuf strBuf) { if (std::ssize(strBuf) < 2 || strBuf.front() != '\"' || strBuf.back() != '\"') { THROW_ERROR_EXCEPTION( @@ -314,7 +314,7 @@ PARSE_INT(ui64, ui64) //////////////////////////////////////////////////////////////////////////////// template <> -TString ConvertFromTextYsonString<TString>(TStringBuf str) +std::string ConvertFromTextYsonString<std::string>(TStringBuf str) { try { return ParseStringFromTextYsonString(str); @@ -324,9 +324,9 @@ TString ConvertFromTextYsonString<TString>(TStringBuf str) } template <> -std::string ConvertFromTextYsonString<std::string>(TStringBuf str) +TString ConvertFromTextYsonString<TString>(TStringBuf str) { - return std::string(ConvertFromTextYsonString<TString>(str)); + return TString(ConvertFromTextYsonString<std::string>(str)); } template <> diff --git a/library/cpp/yt/error/unittests/error_code_ut.cpp b/library/cpp/yt/error/unittests/error_code_ut.cpp index 4bdb17f5d9..833982ea02 100644 --- a/library/cpp/yt/error/unittests/error_code_ut.cpp +++ b/library/cpp/yt/error/unittests/error_code_ut.cpp @@ -61,7 +61,7 @@ YT_DEFINE_ERROR_ENUM( ((Kukarek) (-2007)) ); -TString TestErrorCodeFormatter(int code) +std::string TestErrorCodeFormatter(int code) { return Format("formatted%v", code); } @@ -74,7 +74,7 @@ DEFINE_ENUM(EDifferentTestErrorCode, ((ErrorNumberThree) (-10002)) ); -TString DifferentTestErrorCodeFormatter(int code) +std::string DifferentTestErrorCodeFormatter(int code) { return TEnumTraits<EDifferentTestErrorCode>::ToString(static_cast<EDifferentTestErrorCode>(code)); } diff --git a/library/cpp/yt/error/unittests/error_ut.cpp b/library/cpp/yt/error/unittests/error_ut.cpp index a4248b3956..198aa1ecd8 100644 --- a/library/cpp/yt/error/unittests/error_ut.cpp +++ b/library/cpp/yt/error/unittests/error_ut.cpp @@ -202,7 +202,7 @@ void IterateTestOverEveryRightOperand(TOverloadTest& tester) } template <class T> -void SetErrorAttribute(TError* error, TString key, const T& value) +void SetErrorAttribute(TError* error, const std::string& key, const T& value) { *error <<= TErrorAttribute(key, value); } @@ -357,7 +357,7 @@ TEST(TErrorTest, ThrowErrorExceptionIfFailedMacroExpression) EXPECT_EQ(outerError.GetMessage(), "Outer error"); EXPECT_EQ(outerError.InnerErrors().size(), 1u); EXPECT_EQ(outerError.InnerErrors()[0].GetMessage(), "Inner error"); - EXPECT_EQ(outerError.InnerErrors()[0].Attributes().Get<TString>("attr"), "attr_value"); + EXPECT_EQ(outerError.InnerErrors()[0].Attributes().Get<std::string>("attr"), "attr_value"); } } @@ -427,7 +427,7 @@ TEST(TErrorTest, TruncateSimple) EXPECT_EQ(error.GetPid(), truncatedError.GetPid()); EXPECT_EQ(error.GetTid(), truncatedError.GetTid()); EXPECT_EQ(error.GetDatetime(), truncatedError.GetDatetime()); - EXPECT_EQ(error.Attributes().Get<TString>("my_attr"), truncatedError.Attributes().Get<TString>("my_attr")); + EXPECT_EQ(error.Attributes().Get<std::string>("my_attr"), truncatedError.Attributes().Get<std::string>("my_attr")); EXPECT_EQ(error.InnerErrors().size(), truncatedError.InnerErrors().size()); EXPECT_EQ(error.InnerErrors()[0].GetMessage(), truncatedError.InnerErrors()[0].GetMessage()); } @@ -444,7 +444,7 @@ TEST(TErrorTest, TruncateLarge) auto truncatedError = error.Truncate(/*maxInnerErrorCount*/ 3, /*stringLimit*/ 10); EXPECT_EQ(error.GetCode(), truncatedError.GetCode()); EXPECT_EQ("Some long ...<message truncated>", truncatedError.GetMessage()); - EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<TString>("my_attr")); + EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<std::string>("my_attr")); EXPECT_EQ(truncatedError.InnerErrors().size(), 3u); EXPECT_EQ("First inne...<message truncated>", truncatedError.InnerErrors()[0].GetMessage()); @@ -466,7 +466,7 @@ TEST(TErrorTest, TruncateSimpleRValue) EXPECT_EQ(error.GetPid(), truncatedError.GetPid()); EXPECT_EQ(error.GetTid(), truncatedError.GetTid()); EXPECT_EQ(error.GetDatetime(), truncatedError.GetDatetime()); - EXPECT_EQ(error.Attributes().Get<TString>("my_attr"), truncatedError.Attributes().Get<TString>("my_attr")); + EXPECT_EQ(error.Attributes().Get<std::string>("my_attr"), truncatedError.Attributes().Get<std::string>("my_attr")); EXPECT_EQ(error.InnerErrors().size(), truncatedError.InnerErrors().size()); EXPECT_EQ(error.InnerErrors()[0].GetMessage(), truncatedError.InnerErrors()[0].GetMessage()); } @@ -486,7 +486,7 @@ TEST(TErrorTest, TruncateLargeRValue) EXPECT_EQ(error.GetCode(), truncatedError.GetCode()); EXPECT_EQ("Some long ...<message truncated>", truncatedError.GetMessage()); - EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<TString>("my_attr")); + EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<std::string>("my_attr")); EXPECT_EQ(truncatedError.InnerErrors().size(), 3u); EXPECT_EQ("First inne...<message truncated>", truncatedError.InnerErrors()[0].GetMessage()); @@ -524,8 +524,8 @@ TEST(TErrorTest, TruncateWhitelist) EXPECT_EQ(error.GetCode(), truncatedError.GetCode()); EXPECT_EQ(error.GetMessage(), truncatedError.GetMessage()); - EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<TString>("attr1")); - EXPECT_EQ("Some long long attr", truncatedError.Attributes().Get<TString>("attr2")); + EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<std::string>("attr1")); + EXPECT_EQ("Some long long attr", truncatedError.Attributes().Get<std::string>("attr2")); } TEST(TErrorTest, TruncateWhitelistRValue) @@ -543,8 +543,8 @@ TEST(TErrorTest, TruncateWhitelistRValue) EXPECT_EQ(error.GetCode(), truncatedError.GetCode()); EXPECT_EQ(error.GetMessage(), truncatedError.GetMessage()); - EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<TString>("attr1")); - EXPECT_EQ("Some long long attr", truncatedError.Attributes().Get<TString>("attr2")); + EXPECT_EQ("...<attribute truncated>...", truncatedError.Attributes().Get<std::string>("attr1")); + EXPECT_EQ("Some long long attr", truncatedError.Attributes().Get<std::string>("attr2")); } TEST(TErrorTest, TruncateWhitelistInnerErrors) @@ -563,8 +563,8 @@ TEST(TErrorTest, TruncateWhitelistInnerErrors) auto truncatedInnerError = truncatedError.InnerErrors()[0]; EXPECT_EQ(truncatedInnerError.GetCode(), innerError.GetCode()); EXPECT_EQ(truncatedInnerError.GetMessage(), innerError.GetMessage()); - EXPECT_EQ("...<attribute truncated>...", truncatedInnerError.Attributes().Get<TString>("attr1")); - EXPECT_EQ("Some long long attr", truncatedInnerError.Attributes().Get<TString>("attr2")); + EXPECT_EQ("...<attribute truncated>...", truncatedInnerError.Attributes().Get<std::string>("attr1")); + EXPECT_EQ("Some long long attr", truncatedInnerError.Attributes().Get<std::string>("attr2")); } TEST(TErrorTest, TruncateWhitelistInnerErrorsRValue) @@ -585,8 +585,8 @@ TEST(TErrorTest, TruncateWhitelistInnerErrorsRValue) auto truncatedInnerError = truncatedError.InnerErrors()[0]; EXPECT_EQ(truncatedInnerError.GetCode(), innerError.GetCode()); EXPECT_EQ(truncatedInnerError.GetMessage(), innerError.GetMessage()); - EXPECT_EQ("...<attribute truncated>...", truncatedInnerError.Attributes().Get<TString>("attr1")); - EXPECT_EQ("Some long long attr", truncatedInnerError.Attributes().Get<TString>("attr2")); + EXPECT_EQ("...<attribute truncated>...", truncatedInnerError.Attributes().Get<std::string>("attr1")); + EXPECT_EQ("Some long long attr", truncatedInnerError.Attributes().Get<std::string>("attr2")); } TEST(TErrorTest, TruncateWhitelistSaveInnerError) @@ -668,7 +668,7 @@ TEST(TErrorTest, YTExceptionWithAttributesToError) EXPECT_TRUE(boolValue); EXPECT_EQ(*boolValue, false); - auto stringValue = error.Attributes().Find<TString>("String value"); + auto stringValue = error.Attributes().Find<std::string>("String value"); EXPECT_TRUE(stringValue); EXPECT_EQ(*stringValue, "FooBar"); } @@ -677,19 +677,19 @@ TEST(TErrorTest, YTExceptionWithAttributesToError) TEST(TErrorTest, AttributeSerialization) { auto getWeededText = [] (const TError& err) { - std::vector<TString> lines; + std::vector<std::string> lines; for (const auto& line : StringSplitter(ToString(err)).Split('\n')) { if (!line.Contains("origin") && !line.Contains("datetime")) { - lines.push_back(TString{line}); + lines.push_back(std::string{line}); } } return JoinSeq("\n", lines); }; - EXPECT_EQ(getWeededText(TError("E1") << TErrorAttribute("A1", "V1")), TString( + EXPECT_EQ(getWeededText(TError("E1") << TErrorAttribute("A1", "V1")), std::string( "E1\n" " A1 V1\n")); - EXPECT_EQ(getWeededText(TError("E1") << TErrorAttribute("A1", "L1\nL2\nL3")), TString( + EXPECT_EQ(getWeededText(TError("E1") << TErrorAttribute("A1", "L1\nL2\nL3")), std::string( "E1\n" " A1\n" " L1\n" |