aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrgayazov <brgayazov@yandex-team.com>2022-10-10 22:27:48 +0300
committerbrgayazov <brgayazov@yandex-team.com>2022-10-10 22:27:48 +0300
commit79bf94c9cbcfde5575a1bb13f6261c994492d418 (patch)
treeee293d02b5c67c91fa119b1cfbbd20baef685335
parent9b264bcf96b7f25df988983e4d1eeb5c0bae8d71 (diff)
downloadydb-79bf94c9cbcfde5575a1bb13f6261c994492d418.tar.gz
Fixed processing of incorrect database
-rw-r--r--ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp b/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp
index 20505c92dc4..954360716f2 100644
--- a/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp
+++ b/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp
@@ -296,17 +296,18 @@ void TClientCommandRootCommon::ParseDatabase(TConfig& config) {
void TClientCommandRootCommon::Validate(TConfig& config) {
TClientCommandRootBase::Validate(config);
+ if (!config.NeedToConnect) {
+ return;
+ }
- if (Address.empty() && config.NeedToConnect) {
+ if (Address.empty()) {
throw TMisuseException()
<< "Missing required option 'endpoint'.";
}
if (Database.empty()) {
- if (config.NeedToConnect) {
- throw TMisuseException()
- << "Missing required option 'database'.";
- }
+ throw TMisuseException()
+ << "Missing required option 'database'.";
} else if (!Database.StartsWith('/')) {
throw TMisuseException() << "Path to a database \"" << Database
<< "\" is incorrect. It must be absolute and thus must begin with '/'.";