summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt
diff options
context:
space:
mode:
authormikari <[email protected]>2026-02-20 21:39:29 +0300
committermikari <[email protected]>2026-02-20 22:06:38 +0300
commit7ce6de4e577aa2d195fa5ec995df862c60484b63 (patch)
tree3f4940041eee339251ffd76a28bac02a881ab664 /library/cpp/yt
parentb972f11a5ffee8ffeac87ac0a4b0625a40e79136 (diff)
Fixed error comparison
commit_hash:76b32cc3992d0c6ce820f0b52a06deade4fa7558
Diffstat (limited to 'library/cpp/yt')
-rw-r--r--library/cpp/yt/error/origin_attributes.cpp13
-rw-r--r--library/cpp/yt/error/origin_attributes.h3
2 files changed, 15 insertions, 1 deletions
diff --git a/library/cpp/yt/error/origin_attributes.cpp b/library/cpp/yt/error/origin_attributes.cpp
index 69569762c49..e538670c73f 100644
--- a/library/cpp/yt/error/origin_attributes.cpp
+++ b/library/cpp/yt/error/origin_attributes.cpp
@@ -51,7 +51,8 @@ bool TOriginAttributes::operator==(const TOriginAttributes& other) const noexcep
Datetime == other.Datetime &&
Pid == other.Pid &&
Tid == other.Tid &&
- ExtensionData == other.ExtensionData;
+ ExtensionData.has_value() == other.ExtensionData.has_value() &&
+ (!ExtensionData.has_value() || NDetail::CompareExtensionData(*ExtensionData, *other.ExtensionData));
}
void TOriginAttributes::Capture()
@@ -106,6 +107,16 @@ std::string FormatOrigin(const TOriginAttributes& attributes)
}));
}
+bool CompareExtensionData(const TOriginAttributes::TErasedExtensionData& lhs, const TOriginAttributes::TErasedExtensionData& rhs)
+{
+ using TFunctor = bool(*)(const TOriginAttributes::TErasedExtensionData&, const TOriginAttributes::TErasedExtensionData&);
+
+ if (auto strong = NGlobal::GetErasedVariable(CompareExtensionDataTag)) {
+ return strong->AsConcrete<TFunctor>()(lhs, rhs);
+ }
+ return lhs == rhs;
+}
+
////////////////////////////////////////////////////////////////////////////////
TOriginAttributes ExtractFromDictionary(TErrorAttributes* attributes)
diff --git a/library/cpp/yt/error/origin_attributes.h b/library/cpp/yt/error/origin_attributes.h
index 575b00c57be..8804cdf2569 100644
--- a/library/cpp/yt/error/origin_attributes.h
+++ b/library/cpp/yt/error/origin_attributes.h
@@ -69,6 +69,7 @@ namespace NDetail {
inline constexpr NGlobal::TVariableTag GetExtensionDataTag = {};
inline constexpr NGlobal::TVariableTag FormatOriginTag = {};
inline constexpr NGlobal::TVariableTag ExtractFromDictionaryTag = {};
+inline constexpr NGlobal::TVariableTag CompareExtensionDataTag = {};
////////////////////////////////////////////////////////////////////////////////
@@ -86,6 +87,8 @@ TOriginAttributes ExtractFromDictionary(TErrorAttributes* attributes);
// Default impl of weak symbol.
TOriginAttributes ExtractFromDictionaryDefault(TErrorAttributes* attributes);
+bool CompareExtensionData(const TOriginAttributes::TErasedExtensionData& lhs, const TOriginAttributes::TErasedExtensionData& rhs);
+
} // namespace NDetail
////////////////////////////////////////////////////////////////////////////////