diff options
author | brgayazov <brgayazov@yandex-team.com> | 2022-10-10 22:27:48 +0300 |
---|---|---|
committer | brgayazov <brgayazov@yandex-team.com> | 2022-10-10 22:27:48 +0300 |
commit | 79bf94c9cbcfde5575a1bb13f6261c994492d418 (patch) | |
tree | ee293d02b5c67c91fa119b1cfbbd20baef685335 | |
parent | 9b264bcf96b7f25df988983e4d1eeb5c0bae8d71 (diff) | |
download | ydb-79bf94c9cbcfde5575a1bb13f6261c994492d418.tar.gz |
Fixed processing of incorrect database
-rw-r--r-- | ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp | 11 |
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 '/'."; |