# HG changeset patch # User František Kučera # Date 1600972954 -7200 # Node ID 3297579996641ffdef8b102dd0e83fe624b3f9b0 # Parent ab27422a34b03cd3845cae9307f16c90d168df03 fail-fast: report missing --relation and --attribute early and avoid crashing without any useful error message diff -r ab27422a34b0 -r 329757999664 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; }