diff options
| author | dgolear <[email protected]> | 2025-12-16 23:43:58 +0300 |
|---|---|---|
| committer | dgolear <[email protected]> | 2025-12-17 00:07:43 +0300 |
| commit | 145abafe39ddfc015a3751acd59e0460b6c2218b (patch) | |
| tree | 9031e7b8f6faa2a3686441b155e24dbb28f3e56d /library/cpp/yt/error/error.cpp | |
| parent | 417887555f18d06cab04c089fdcf3d82de744b31 (diff) | |
YT: Do not merge OK errors to inner errors
commit_hash:7204f6d279e6660168d497e5fc43a8fd6a21acaa
Diffstat (limited to 'library/cpp/yt/error/error.cpp')
| -rw-r--r-- | library/cpp/yt/error/error.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
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<TErrorAttribute>& 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<TError>& 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<TError>&& 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; } |
