diff options
author | arkady-e1ppa <arkady-e1ppa@yandex-team.com> | 2024-12-26 10:52:40 +0300 |
---|---|---|
committer | arkady-e1ppa <arkady-e1ppa@yandex-team.com> | 2024-12-26 11:12:17 +0300 |
commit | 0328aa1f62630f14d06076175e2f3750969ac813 (patch) | |
tree | a2652fb95c5a603e15f1692b43b10e4bf036f084 /library/cpp/yt/error/error_attributes.cpp | |
parent | b4473180e344fac1deb5f4e85fc681efe2c708de (diff) | |
download | ydb-0328aa1f62630f14d06076175e2f3750969ac813.tar.gz |
YT-21233: Drop dependency on yson in library/cpp/yt/error by switch to std::string everywhere
done
commit_hash:8a83afa39917ba66a5161388a7cd74a4488d9908
Diffstat (limited to 'library/cpp/yt/error/error_attributes.cpp')
-rw-r--r-- | library/cpp/yt/error/error_attributes.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/library/cpp/yt/error/error_attributes.cpp b/library/cpp/yt/error/error_attributes.cpp index 06db3b211e..fcfe80c414 100644 --- a/library/cpp/yt/error/error_attributes.cpp +++ b/library/cpp/yt/error/error_attributes.cpp @@ -9,7 +9,7 @@ namespace NYT { std::vector<TErrorAttributes::TKey> TErrorAttributes::ListKeys() const { - std::vector<TString> keys; + std::vector<TKey> keys; keys.reserve(Map_.size()); for (const auto& [key, value] : Map_) { keys.push_back(key); @@ -27,10 +27,12 @@ std::vector<TErrorAttributes::TKeyValuePair> TErrorAttributes::ListPairs() const return pairs; } -TErrorAttributes::TValue TErrorAttributes::FindValue(TStringBuf key) const +std::optional<TErrorAttribute::TValue> TErrorAttributes::FindValue(TStringBuf key) const { auto it = Map_.find(key); - return it == Map_.end() ? TValue{} : it->second; + return it == Map_.end() + ? std::nullopt + : std::optional(it->second); } void TErrorAttributes::SetValue(const TKey& key, const TValue& value) @@ -54,7 +56,7 @@ TErrorAttributes::TValue TErrorAttributes::GetValue(TStringBuf key) const if (!result) { ThrowNoSuchAttributeException(key); } - return result; + return *result; } void TErrorAttributes::Clear() |