summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/http/helpers.cpp
diff options
context:
space:
mode:
authorhiddenpath <[email protected]>2025-02-16 18:55:43 +0300
committerhiddenpath <[email protected]>2025-02-16 19:48:24 +0300
commit44db6ad76e089948a9be7e473b7a65a532bda10e (patch)
treea7dada3985cc7f1bb79e31d1cf46da4e1e374cba /yt/cpp/mapreduce/http/helpers.cpp
parenta6575133f91c6e057e360884176b421f40ecaa1e (diff)
YT-23616: Implement generic errors extending method
commit_hash:931d1114b30ea24bb1dcf9d2b4cece06f4467498
Diffstat (limited to 'yt/cpp/mapreduce/http/helpers.cpp')
-rw-r--r--yt/cpp/mapreduce/http/helpers.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/yt/cpp/mapreduce/http/helpers.cpp b/yt/cpp/mapreduce/http/helpers.cpp
index 0e34610ef1a..c819e515b87 100644
--- a/yt/cpp/mapreduce/http/helpers.cpp
+++ b/yt/cpp/mapreduce/http/helpers.cpp
@@ -100,6 +100,16 @@ void LogRequest(const THttpHeader& header, const TString& url, bool includeParam
GetLoggedAttributes(header, url, includeParameters, Max<size_t>()));
}
+void ExtendGenericError(TErrorResponse& errorResponse, int code, TString message)
+{
+ const auto& error = errorResponse.GetError();
+
+ auto inner = error.InnerErrors();
+ inner.emplace_back(code, std::move(message));
+
+ errorResponse.SetError(TYtError(error.GetCode(), error.GetMessage(), std::move(inner), error.GetAttributes()));
+}
+
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT