Skip to content

Commit 0099b9c

Browse files
authored
Revert "25-1: TOptionsParseResult: throwing an exception in case of options parsing errors" (ydb-platform#16754)
1 parent ad8b24c commit 0099b9c

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

ydb/public/lib/ydb_cli/common/command.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ int TClientCommand::Process(TConfig& config) {
204204
}
205205

206206
void TClientCommand::SaveParseResult(TConfig& config) {
207-
ParseResult = std::make_shared<TCommandOptsParseResult>(config.Opts, config.ArgC, config.ArgV);
207+
ParseResult = std::make_shared<NLastGetopt::TOptsParseResult>(config.Opts, config.ArgC, config.ArgV);
208208
}
209209

210210
void TClientCommand::Prepare(TConfig& config) {

ydb/public/lib/ydb_cli/common/command.h

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -326,36 +326,7 @@ class TClientCommand {
326326
}
327327
};
328328

329-
class TCommandOptsParseResult: public NLastGetopt::TOptsParseResult {
330-
public:
331-
TCommandOptsParseResult(const NLastGetopt::TOpts* options, int argc, const char* argv[]) {
332-
Init(options, argc, argv);
333-
}
334-
TCommandOptsParseResult(const NLastGetopt::TOpts* options, int argc, char* argv[]) {
335-
Init(options, argc, const_cast<const char**>(argv));
336-
}
337-
virtual ~TCommandOptsParseResult() = default;
338-
339-
void HandleError() const override {
340-
if (ThrowOnParseError) {
341-
throw;
342-
}
343-
NLastGetopt::TOptsParseResult::HandleError();
344-
}
345-
346-
protected:
347-
TCommandOptsParseResult() = default;
348-
349-
void Init(const NLastGetopt::TOpts* options, int argc, const char* argv[]) {
350-
ThrowOnParseError = options->HasLongOption("throw-on-parse-error");
351-
NLastGetopt::TOptsParseResult::Init(options, argc, argv);
352-
}
353-
354-
private:
355-
bool ThrowOnParseError = false;
356-
};
357-
358-
class TOptsParseOneLevelResult : public TCommandOptsParseResult {
329+
class TOptsParseOneLevelResult : public NLastGetopt::TOptsParseResult {
359330
public:
360331
TOptsParseOneLevelResult(TConfig& config);
361332
};

0 commit comments

Comments
 (0)