fail-fast: report missing --relation and --attribute early and avoid crashing without any useful error message v_0 v0.17
authorFrantišek Kučera <franta-hg@frantovo.cz>
Thu, 24 Sep 2020 20:42:34 +0200
branchv_0
changeset 47 329757999664
parent 46 ab27422a34b0
child 48 610b6baca7f9
fail-fast: report missing --relation and --attribute early and avoid crashing without any useful error message
src/CLIParser.h
--- a/src/CLIParser.h	Thu Sep 24 20:37:52 2020 +0200
+++ b/src/CLIParser.h	Thu Sep 24 20:42:34 2020 +0200
@@ -107,6 +107,9 @@
 		}
 		addRelation(c, currentRelation); // last relation
 
+		if (c.relationConfigurations.size() == 0) throw relpipe::cli::RelpipeCLIException(L"There must be at least one relation. Use the " + OPTION_RELATION + L" option.", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
+		for (auto& rc : c.relationConfigurations) if (rc.attributes.size() == 0) throw relpipe::cli::RelpipeCLIException(L"There must be at least one attribute. Use the " + OPTION_ATTRIBUTE + L" option.", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
+
 		return c;
 	}