summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/http/http.cpp
diff options
context:
space:
mode:
authorermolovd <[email protected]>2026-04-23 10:38:04 +0300
committerermolovd <[email protected]>2026-04-23 11:13:35 +0300
commit3e8e8b855a4e506c0b2e95f0c77ab9790007f9fd (patch)
tree58885b17992d4edf58b14a443cea3c88cc0ff0a9 /yt/cpp/mapreduce/http/http.cpp
parent342279b2e1f206e259a0c42a23f15b0043d42d50 (diff)
throw TErrorResponse instead of TTransportError
commit_hash:c4f32aac4b251cfb981bc2549522fa92881ae370
Diffstat (limited to 'yt/cpp/mapreduce/http/http.cpp')
-rw-r--r--yt/cpp/mapreduce/http/http.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/yt/cpp/mapreduce/http/http.cpp b/yt/cpp/mapreduce/http/http.cpp
index 79a172a0417..8137f5a8212 100644
--- a/yt/cpp/mapreduce/http/http.cpp
+++ b/yt/cpp/mapreduce/http/http.cpp
@@ -42,7 +42,7 @@ std::exception_ptr WrapSystemError(
const std::exception& ex)
{
if (auto errorResponse = dynamic_cast<const TErrorResponse*>(&ex); errorResponse != nullptr) {
- return std::make_exception_ptr(errorResponse);
+ return std::make_exception_ptr(*errorResponse);
}
auto message = NYT::Format("Request %qv to %qv failed", context.RequestId, context.HostName + context.Method);
@@ -51,7 +51,7 @@ std::exception_ptr WrapSystemError(
{"host", context.HostName},
{"method", context.Method},
});
- TTransportError errorResponse(std::move(outer));
+ TErrorResponse errorResponse(std::move(outer), context.RequestId);
return std::make_exception_ptr(errorResponse);
}
@@ -125,8 +125,12 @@ private:
Y_ABORT_UNLESS(WriteError_ != nullptr);
try {
HttpRequest_->GetResponseStream();
- } catch (const TErrorResponse &) {
- throw;
+ } catch (const TErrorResponse& e) {
+ // If we can read more meaningful error, we'll throw that error.
+ // If we can't read such error, we'll rethrow original WriteError_ below.
+ if (!e.IsTransportError()) {
+ throw;
+ }
} catch (...) {
}
std::rethrow_exception(WriteError_);