Skip to content

Commit 58a0bad

Browse files
author
ermolovd
committed
improve error message
commit_hash:f5a840952c97d019b950bc1093d1e379dcebbb6d
1 parent 9491c44 commit 58a0bad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

yt/cpp/mapreduce/http/host_manager.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "helpers.h"
55
#include "http.h"
66
#include "http_client.h"
7-
#include "requests.h"
87

98
#include <yt/cpp/mapreduce/interface/logging/yt_log.h>
109

@@ -124,8 +123,13 @@ THostManager::TClusterHostList THostManager::GetHosts(const TClientContext& cont
124123
auto requestId = CreateGuidAsString();
125124
// TODO: we need to set socket timeout here
126125
UpdateHeaderForProxyIfNeed(context.ServerName, context, header);
127-
auto response = context.HttpClient->Request(GetFullUrlForProxy(context.ServerName, context, header), requestId, header);
126+
auto url = GetFullUrlForProxy(context.ServerName, context, header);
127+
auto response = context.HttpClient->Request(url, requestId, header);
128128
auto hosts = ParseJsonStringArray(response->GetResponse());
129+
if (hosts.empty()) {
130+
const auto error = Format("Getting %Qv returned empty host list", url);
131+
return TClusterHostList(std::make_exception_ptr(yexception() << error));
132+
}
129133
for (auto& host : hosts) {
130134
host = CreateHostNameWithPort(host, context);
131135
}

0 commit comments

Comments
 (0)