aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpnv1 <pnv@ydb.tech>2023-05-23 12:15:53 +0300
committerpnv1 <pnv@ydb.tech>2023-05-23 12:15:53 +0300
commit5dce6a0c3ca260e259ac29941e7ce86a07467156 (patch)
tree85e0145c08f87f47318a9ec634618e692d7691c5
parentb521372ce98cf89c2f89ecce4c4c955bb7f10884 (diff)
downloadydb-5dce6a0c3ca260e259ac29941e7ce86a07467156.tar.gz
Do not ignore errors while receiving token for static credentials
-rw-r--r--ydb/public/sdk/cpp/client/ydb_types/credentials/login/login.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/ydb/public/sdk/cpp/client/ydb_types/credentials/login/login.cpp b/ydb/public/sdk/cpp/client/ydb_types/credentials/login/login.cpp
index 6b08cfcc4b..48528e5971 100644
--- a/ydb/public/sdk/cpp/client/ydb_types/credentials/login/login.cpp
+++ b/ydb/public/sdk/cpp/client/ydb_types/credentials/login/login.cpp
@@ -167,10 +167,20 @@ TString TLoginCredentialsProvider::GetToken() const {
}
TString TLoginCredentialsProvider::GetError() const {
- if (Response_.operation().issues_size() > 0) {
- return Response_.operation().issues(0).message();
+ if (Status_.Ok()) {
+ if (Response_.operation().issues_size() > 0) {
+ return Response_.operation().issues(0).message();
+ } else {
+ return Ydb::StatusIds_StatusCode_Name(Response_.operation().status());
+ }
} else {
- return Ydb::StatusIds_StatusCode_Name(Response_.operation().status());
+ TStringBuilder str;
+ str << "Couldn't get token for provided credentials from " << Status_.Endpoint
+ << " with status " << Status_.Status << ".";
+ for (const auto& issue : Status_.Issues) {
+ str << Endl << "Issue: " << issue;
+ }
+ return str;
}
}