diff options
| author | ermolovd <[email protected]> | 2026-03-12 22:24:10 +0300 |
|---|---|---|
| committer | ermolovd <[email protected]> | 2026-03-12 22:49:08 +0300 |
| commit | 4e222e2aff9b602868a2f56feb9400293afd634c (patch) | |
| tree | 81d03bbcfe3aca9c37b6bb763622d9dca9b51bdf /yt/cpp/mapreduce/http/http_client.cpp | |
| parent | b362f3a3b9d713a6370cad73a09b27d27e6ac73b (diff) | |
fetch dynamic config through cache, don't scare the users with expected errors
commit_hash:03d0aeb6901ca96aae2f8570482204f0ca707c88
Diffstat (limited to 'yt/cpp/mapreduce/http/http_client.cpp')
| -rw-r--r-- | yt/cpp/mapreduce/http/http_client.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/yt/cpp/mapreduce/http/http_client.cpp b/yt/cpp/mapreduce/http/http_client.cpp index b2e88c5fa00..8f0fb723d2d 100644 --- a/yt/cpp/mapreduce/http/http_client.cpp +++ b/yt/cpp/mapreduce/http/http_client.cpp @@ -5,6 +5,8 @@ #include "helpers.h" #include "http.h" +#include <yt/cpp/mapreduce/common/expected_error_guard.h> + #include <yt/cpp/mapreduce/interface/config.h> #include <yt/cpp/mapreduce/interface/error_codes.h> @@ -74,21 +76,27 @@ TMaybe<TErrorResponse> GetErrorResponse(const TString& hostName, const TString& static_cast<int>(httpCode), httpHeaders.Str().data()); - YT_LOG_ERROR("%v", - errorString.data()); - + TMaybe<TErrorResponse> errorResponse; if (auto errorHeader = response->GetHeaders()->Find("X-YT-Error")) { TYtError error; error.ParseFrom(*errorHeader); - TErrorResponse errorResponse(std::move(error), requestId); - if (errorResponse.IsOk()) { - return Nothing(); + if (error.GetCode() != 0) { + errorResponse.Emplace(std::move(error), requestId); } - return errorResponse; + } else { + errorResponse = TErrorResponse(TYtError(errorString + " - X-YT-Error is missing in headers"), requestId); + } + + if (errorResponse && TExpectedErrorGuard::IsErrorExpected(*errorResponse)) { + YT_LOG_INFO("%v", + errorString.data()); + } else { + YT_LOG_ERROR("%v", + errorString.data()); } - return TErrorResponse(TYtError(errorString + " - X-YT-Error is missing in headers"), requestId); + return errorResponse; } } } |
