summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/interface/errors.cpp
diff options
context:
space:
mode:
authorhiddenpath <[email protected]>2025-02-17 18:27:28 +0300
committerhiddenpath <[email protected]>2025-02-17 18:47:38 +0300
commit3c5cdafe4d5d0d0c34bbd52976d760a37861fd80 (patch)
treee3edcd75071ed42a980626f0ab0265b8c17e25d6 /yt/cpp/mapreduce/interface/errors.cpp
parent5bf080f68ee290850e430342c635cb62859cad61 (diff)
YT-23616: Add IsUnauthorized method to TErrorResponse
commit_hash:eb23d10ce4143a7cc122794f85c66072b317fc44
Diffstat (limited to 'yt/cpp/mapreduce/interface/errors.cpp')
-rw-r--r--yt/cpp/mapreduce/interface/errors.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/yt/cpp/mapreduce/interface/errors.cpp b/yt/cpp/mapreduce/interface/errors.cpp
index 40a2d5234c0..fcc23fb3acb 100644
--- a/yt/cpp/mapreduce/interface/errors.cpp
+++ b/yt/cpp/mapreduce/interface/errors.cpp
@@ -355,6 +355,22 @@ bool TErrorResponse::IsAccessDenied() const
return Error_.ContainsErrorCode(NClusterErrorCodes::NSecurityClient::AuthorizationError);
}
+bool TErrorResponse::IsUnauthorized() const
+{
+ const auto allCodes = Error_.GetAllErrorCodes();
+ for (auto code : {
+ NClusterErrorCodes::NRpc::AuthenticationError,
+ NClusterErrorCodes::NRpc::InvalidCsrfToken,
+ NClusterErrorCodes::NRpc::InvalidCredentials,
+ NClusterErrorCodes::NSecurityClient::AuthenticationError,
+ }) {
+ if (allCodes.contains(code)) {
+ return true;
+ }
+ }
+ return false;
+}
+
bool TErrorResponse::IsConcurrentTransactionLockConflict() const
{
return Error_.ContainsErrorCode(NClusterErrorCodes::NCypressClient::ConcurrentTransactionLockConflict);