aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/http/http_client.cpp
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2025-02-18 13:35:23 +0000
committerAlexander Smirnov <alex@ydb.tech>2025-02-18 13:35:23 +0000
commitd1f5b91da822b27faad83d50ecfdd2830a1be93e (patch)
tree78df3bf535cb8a5451afa402c51cb3f8d11b4d06 /yt/cpp/mapreduce/http/http_client.cpp
parent22bc9b81495143d67a93bf58c936c5d5a65c8e8e (diff)
parenta2f16dc9eb108ecf11938c7c4275d701a3635bb7 (diff)
downloadydb-d1f5b91da822b27faad83d50ecfdd2830a1be93e.tar.gz
Merge pull request #14716 from ydb-platform/merge-libs-250218-0050
Diffstat (limited to 'yt/cpp/mapreduce/http/http_client.cpp')
-rw-r--r--yt/cpp/mapreduce/http/http_client.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/yt/cpp/mapreduce/http/http_client.cpp b/yt/cpp/mapreduce/http/http_client.cpp
index 7e9d761c3c..34be58daab 100644
--- a/yt/cpp/mapreduce/http/http_client.cpp
+++ b/yt/cpp/mapreduce/http/http_client.cpp
@@ -7,6 +7,7 @@
#include <yt/cpp/mapreduce/interface/config.h>
+#include <yt/cpp/mapreduce/interface/error_codes.h>
#include <yt/cpp/mapreduce/interface/logging/yt_log.h>
#include <yt/yt/core/concurrency/thread_pool_poller.h>
@@ -42,21 +43,22 @@ TMaybe<TErrorResponse> GetErrorResponse(const TString& hostName, const TString&
TErrorResponse errorResponse(static_cast<int>(httpCode), requestId);
- auto logAndSetError = [&] (const TString& rawError) {
+ auto logAndSetError = [&] (int code, const TString& rawError) {
YT_LOG_ERROR("RSP %v - HTTP %v - %v",
requestId,
httpCode,
rawError.data());
- errorResponse.SetRawError(rawError);
+ errorResponse.SetError(TYtError(code, rawError));
};
+
switch (httpCode) {
case NHttp::EStatusCode::TooManyRequests:
- logAndSetError("request rate limit exceeded");
+ logAndSetError(NClusterErrorCodes::NSecurityClient::RequestQueueSizeLimitExceeded, "request rate limit exceeded");
break;
case NHttp::EStatusCode::InternalServerError:
- logAndSetError("internal error in proxy " + hostName);
+ logAndSetError(NClusterErrorCodes::NRpc::Unavailable, "internal error in proxy " + hostName);
break;
default: {
@@ -80,6 +82,9 @@ TMaybe<TErrorResponse> GetErrorResponse(const TString& hostName, const TString&
if (errorResponse.IsOk()) {
return Nothing();
}
+ if (httpCode == NHttp::EStatusCode::ServiceUnavailable) {
+ ExtendGenericError(errorResponse, NClusterErrorCodes::NBus::TransportError, "transport error");
+ }
return errorResponse;
}