From 145abafe39ddfc015a3751acd59e0460b6c2218b Mon Sep 17 00:00:00 2001 From: dgolear Date: Tue, 16 Dec 2025 23:43:58 +0300 Subject: YT: Do not merge OK errors to inner errors commit_hash:7204f6d279e6660168d497e5fc43a8fd6a21acaa --- library/cpp/yt/error/error.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'library/cpp/yt/error/error.cpp') diff --git a/library/cpp/yt/error/error.cpp b/library/cpp/yt/error/error.cpp index c6e806fc58d..1fbea4c8a4f 100644 --- a/library/cpp/yt/error/error.cpp +++ b/library/cpp/yt/error/error.cpp @@ -716,31 +716,30 @@ TError& TError::operator <<= (const std::vector& attributes) & TError& TError::operator <<= (const TError& innerError) & { - MutableInnerErrors()->push_back(innerError); + if (!innerError.IsOK()) { + MutableInnerErrors()->push_back(innerError); + } return *this; } TError& TError::operator <<= (TError&& innerError) & { - MutableInnerErrors()->push_back(std::move(innerError)); + if (!innerError.IsOK()) { + MutableInnerErrors()->push_back(std::move(innerError)); + } return *this; } TError& TError::operator <<= (const std::vector& innerErrors) & { - MutableInnerErrors()->insert( - MutableInnerErrors()->end(), - innerErrors.begin(), - innerErrors.end()); + std::ranges::copy_if(innerErrors, std::back_inserter(*MutableInnerErrors()), std::not_fn(&TError::IsOK)); return *this; } TError& TError::operator <<= (std::vector&& innerErrors) & { - MutableInnerErrors()->insert( - MutableInnerErrors()->end(), - std::make_move_iterator(innerErrors.begin()), - std::make_move_iterator(innerErrors.end())); + auto filteredErrors = std::views::filter(innerErrors, std::not_fn(&TError::IsOK)); + std::ranges::move(filteredErrors, std::back_inserter(*MutableInnerErrors())); return *this; } -- cgit v1.3