Skip to content

Commit

Permalink
Fix error output formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pnv1 committed Sep 24, 2024
1 parent 7916118 commit 6e597f4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
10 changes: 3 additions & 7 deletions ydb/public/lib/ydb_cli/commands/ydb_service_scripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ void TCommandExecuteYqlScript::Parse(TConfig& config) {
TClientCommand::Parse(config);
ParseFormats();
if (!Script && !ScriptFile) {
throw TMisuseException() << "Neither \"Text of script\" (\"--script\", \"-s\") "
<< "nor \"Path to file with script text\" (\"--file\", \"-f\") were provided.";
Cerr << "Neither \"Text of script\" (\"--script\", \"-s\") "
<< "nor \"Path to file with script text\" (\"--file\", \"-f\") were provided." << Endl;
config.PrintHelpAndExit();
}
if (Script && ScriptFile) {
throw TMisuseException() << "Both mutually exclusive options \"Text of script\" (\"--script\", \"-s\") "
Expand All @@ -94,11 +95,6 @@ void TCommandExecuteYqlScript::Parse(TConfig& config) {
if (ScriptFile) {
Script = ReadFromFile(ScriptFile, "script");
}
if (Script.Empty()) {
Cerr << "Neither text of script (\"--script\", \"-s\") "
<< "nor path to file with script text (\"--file\", \"-f\") were provided.";
config.PrintHelpAndExit();
}
if(FlameGraphPath && FlameGraphPath->Empty())
{
throw TMisuseException() << "FlameGraph path can not be empty.";
Expand Down
2 changes: 1 addition & 1 deletion ydb/public/lib/ydb_cli/commands/ydb_service_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ int TCommandDropTable::Run(TConfig& config) {
void TCommandQueryBase::CheckQueryOptions(TClientCommand::TConfig& config) const {
if (!Query && !QueryFile) {
Cerr << "Neither \"Text of query\" (\"--query\", \"-q\") "
<< "nor \"Path to file with query text\" (\"--file\", \"-f\") were provided.";
<< "nor \"Path to file with query text\" (\"--file\", \"-f\") were provided." << Endl;
config.PrintHelpAndExit();
}
if (Query && QueryFile) {
Expand Down
2 changes: 1 addition & 1 deletion ydb/public/lib/ydb_cli/commands/ydb_sql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void TCommandSql::Parse(TConfig& config) {
}
if (Query.Empty()) {
Cerr << "Neither text of script (\"--script\", \"-s\") "
<< "nor path to file with script text (\"--file\", \"-f\") were provided.";
<< "nor path to file with script text (\"--file\", \"-f\") were provided." << Endl;
config.PrintHelpAndExit();
}
}
Expand Down
2 changes: 1 addition & 1 deletion ydb/public/lib/ydb_cli/commands/ydb_yql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void TCommandYql::Parse(TConfig& config) {
}
if (Script.Empty()) {
Cerr << "Neither text of script (\"--script\", \"-s\") "
<< "nor path to file with script text (\"--file\", \"-f\") were provided.";
<< "nor path to file with script text (\"--file\", \"-f\") were provided." << Endl;
config.PrintHelpAndExit();
}
if(FlameGraphPath && FlameGraphPath->Empty())
Expand Down

0 comments on commit 6e597f4

Please sign in to comment.