diff --git a/CHANGELOG.md b/CHANGELOG.md
index 94df8497500..c20d46e1c64 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -54,6 +54,13 @@ If possible, provide tooling that performs the changes, e.g. a shell-script.
the respective instances (e.g. change `input_file_validator` to `input_file_validator<>`).
* The member type that denotes which arguments a `validator` can validate has been renamed from `value_type` to
`option_value_type`.
+* **Some exception names were altered and some removed**
+ * The exception seqan3::parser_invalid_argument was renamed to seqan3::argument_parser_error.
+ * The exception seqan3::validation_failed was renamed to seqan3::validation_error.
+ * The exception seqan3::parser_design_error was renamed to seqan3::design_error and also inherits from
+ seqan3::argument_parser_error.
+ * The exception Seqan3::type_conversion_failed was removed, you can catch seqan3::user_input_error instead.
+ * The exception Seqan3::overflow_error was removed, you can catch seqan3::user_input_error instead.
#### Core
diff --git a/doc/howto/subcommand_argument_parser/subcommand_arg_parse.cpp b/doc/howto/subcommand_argument_parser/subcommand_arg_parse.cpp
index fee1f98dfb8..08852bd8ae4 100644
--- a/doc/howto/subcommand_argument_parser/subcommand_arg_parse.cpp
+++ b/doc/howto/subcommand_argument_parser/subcommand_arg_parse.cpp
@@ -24,7 +24,7 @@ int run_git_pull(argument_parser & parser)
{
parser.parse();
}
- catch (parser_invalid_argument const & ext)
+ catch (argument_parser_error const & ext)
{
debug_stream << "[Error git pull] " << ext.what() << "\n";
return -1;
@@ -57,7 +57,7 @@ int run_git_push(argument_parser & parser)
{
parser.parse();
}
- catch (parser_invalid_argument const & ext)
+ catch (argument_parser_error const & ext)
{
debug_stream << "[Error git push] " << ext.what() << "\n";
return -1;
@@ -89,7 +89,7 @@ int main(int argc, char const ** argv)
{
top_level_parser.parse(); // trigger command line parsing
}
- catch (parser_invalid_argument const & ext) // catch user errors
+ catch (argument_parser_error const & ext) // catch user errors
{
debug_stream << "[Error] " << ext.what() << "\n"; // customise your error message
return -1;
diff --git a/doc/tutorial/alphabet/alphabet_gc_content.cpp b/doc/tutorial/alphabet/alphabet_gc_content.cpp
index 41bb37a028b..680d23128c6 100644
--- a/doc/tutorial/alphabet/alphabet_gc_content.cpp
+++ b/doc/tutorial/alphabet/alphabet_gc_content.cpp
@@ -20,7 +20,7 @@ int main (int argc, char * argv[])
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the input is invalid
+ catch (seqan3::argument_parser_error const & ext) // the input is invalid
{
seqan3::debug_stream << "[PARSER ERROR] " << ext.what() << '\n';
return 0;
diff --git a/doc/tutorial/argument_parser/basic_parser_setup.cpp b/doc/tutorial/argument_parser/basic_parser_setup.cpp
index bf8edd8885a..37827ce71e9 100644
--- a/doc/tutorial/argument_parser/basic_parser_setup.cpp
+++ b/doc/tutorial/argument_parser/basic_parser_setup.cpp
@@ -11,7 +11,7 @@ int main(int argc, char ** argv)
{
myparser.parse(); // trigger command line parsing
}
- catch (seqan3::parser_invalid_argument const & ext) // catch user errors
+ catch (seqan3::argument_parser_error const & ext) // catch user errors
{
seqan3::debug_stream << "[Winter has come] " << ext.what() << "\n"; // customise your error message
return -1;
diff --git a/doc/tutorial/argument_parser/index.md b/doc/tutorial/argument_parser/index.md
index de5dfaf5dbc..1ba887c089c 100644
--- a/doc/tutorial/argument_parser/index.md
+++ b/doc/tutorial/argument_parser/index.md
@@ -49,11 +49,11 @@ Before we add any of the options, flags, and positional options, we will take a
\include doc/tutorial/argument_parser/basic_parser_setup.cpp
-There are two types of exceptions: The seqan3::parser_design_error which indicates that the parser setup was wrong (directed to the developer of the program, not the user!) and the seqan3::parser_invalid_argument, which detects corrupted user input. Additionally, there are special user requests that are handled by the argument parser by exiting the program via std::exit, e.g. calling `--help` that prints a help page screen.
+There are two types of exceptions: The seqan3::design_error which indicates that the parser setup was wrong (directed to the developer of the program, not the user!) and any other exception derived from seqan3::argument_parser_error, which detects corrupted user input. Additionally, there are special user requests that are handled by the argument parser by exiting the program via std::exit, e.g. calling `--help` that prints a help page screen.
-## Design restrictions (seqan3::parser_design_error)
+## Design restrictions (seqan3::design_error)
-The argument parser checks the following restrictions and throws a seqan3::parser_design_error if they are not satisfied:
+The argument parser checks the following restrictions and throws a seqan3::design_error if they are not satisfied:
* **Long identifiers**: must be unique, more than one character long, may only contain alphanumeric characters, as well as `_`, `-`, or `@`, but never start with `-`.
* **Short identifiers**: must be unique and consist of only a single letter that is alphanumeric characters, `_` or `@`.
@@ -62,7 +62,7 @@ The argument parser checks the following restrictions and throws a seqan3::parse
* The flag identifiers `-h`, `--help`, `--advanced-help`, `--advanced-help`, `--export-help`, `--version`, `--copyright` are predefined and cannot be specified manually or used otherwise.
* The seqan3::argument_parser::parse function may only be called once (per parser).
-## Input restrictions (seqan3::parser_invalid_argument)
+## Input restrictions
When calling the seqan3::argument_parser::parse function, the following potential user errors are caught (and handled by throwing a corresponding exception):
@@ -71,8 +71,8 @@ When calling the seqan3::argument_parser::parse function, the following potentia
seqan3::too_many_arguments | More command line arguments than expected are given. |
seqan3::too_few_arguments | Less command line arguments than expected are given. |
seqan3::required_option_missing | A required option is not given (see [Required options](#section_required_option)) |
- seqan3::type_conversion_failed | The given value cannot be cast to the expected type |
- seqan3::validation_failed | (Positional-)Option validation failed (see [Validators](#section_validation)) |
+ seqan3::user_input_error | The given (positional) option value was invalid. |
+ seqan3::validation_error | (Positional-)Option validation failed (see [Validators](#section_validation)) |
## Special Requests (std::exit)
@@ -142,7 +142,7 @@ Now that we're done with the meta information, we will learn how to add the actu
Each of the functions above take a variable by reference as the first parameter, which will directly store the corresponding parsed value from the command line. This has two advantages compared to other command line parsers: (1) There is no need for a getter function after parsing and (2) the type is automatically deduced (e.g. with boost::program_options you would need to access `parser["file_path"].as()` afterwards).
-The seqan3::argument_parser::add_flag only allows boolean variables while seqan3::argument_parser::add_option and seqan3::argument_parser::add_positional_option allow **any type that is convertible from a std::string via std::from_chars** or a container of the former (see \ref tutorial_argument_parser_list_options). Besides accepting generic types, the parser will **automatically check if the given command line argument can be converted into the desired type** and otherwise throw a seqan3::type_conversion_failed exception.
+The seqan3::argument_parser::add_flag only allows boolean variables while seqan3::argument_parser::add_option and seqan3::argument_parser::add_positional_option allow **any type that is convertible from a std::string via std::from_chars** or a container of the former (see \ref tutorial_argument_parser_list_options). Besides accepting generic types, the parser will **automatically check if the given command line argument can be converted into the desired type** and otherwise throw a seqan3::type_conversion_error exception.
So how does this look like? The following code snippet adds a positional option to `parser`.
@@ -229,7 +229,7 @@ The vector `list_variable` will then contain all three names `["Jon", "Arya", "N
## List positional options? {#section_list_positional_options}
-An arbitrary positional option cannot be a list because of the ambiguity of which value belongs to which positional option. We do allow the very last option to be a list for convenience though. Note that if you try to add a positional list option which is not the last positional option, a seqan3::parser_design_error will be thrown.
+An arbitrary positional option cannot be a list because of the ambiguity of which value belongs to which positional option. We do allow the very last option to be a list for convenience though. Note that if you try to add a positional list option which is not the last positional option, a seqan3::design_error will be thrown.
Example:
@@ -355,7 +355,7 @@ All the validators below work on single values or a container of values. In case
### The seqan3::arithmetic_range_validator
On construction, this validator receives a maximum and a minimum number.
-The validator throws a seqan3::parser_invalid_argument exception whenever a given value does not lie inside the given min/max range.
+The validator throws a seqan3::validation_error exception whenever a given value does not lie inside the given min/max range.
\snippet test/snippet/argument_parser/validators_1.cpp validator_call
@@ -371,7 +371,7 @@ Add a seqan3::arithmetic_range_validator to the `-s/--season` option that sets t
### The seqan3::value_list_validator
On construction, the validator receives a list (vector) of valid values.
-The validator throws a seqan3::parser_invalid_argument exception whenever a given value is not in the given list.
+The validator throws a seqan3::validation_error exception whenever a given value is not in the given list.
\snippet test/snippet/argument_parser/validators_2.cpp validator_call
@@ -387,7 +387,7 @@ Add a seqan3::value_list_validator to the `-a/--aggregate-by` option that sets t
SeqAn offers two file validator types: the seqan3::input_file_validator and the seqan3::output_file_validator.
On construction, the validator receives a list (vector) of valid file extensions that are tested against the extension
of the parsed option value.
-The validator throws a seqan3::parser_invalid_argument exception whenever a given filename's extension is not in the
+The validator throws a seqan3::validation_error exception whenever a given filename's extension is not in the
given list of valid extensions. In addition, the seqan3::input_file_validator checks if the file exists, is a regular
file and is readable.
The seqan3::output_file_validator on the other hand ensures that the output does not already exist (in order to prevent
@@ -411,7 +411,7 @@ to provide an input directory (using the seqan3::input_directory_validator) or o
The seqan3::input_directory_validator checks whether the specified path is a directory and is readable.
Similarly, the seqan3::output_directory_validator checks whether the specified directory is writable and can be created,
if it does not already exists.
-If the tests fail, a seqan3::parser_invalid_argument exception will be thrown. Also, if something unexpected with the
+If the tests fail, a seqan3::validation_error exception will be thrown. Also, if something unexpected with the
filesystem happens, a std::filesystem_error will be thrown.
Using the seqan3::input_directory_validator:
@@ -435,7 +435,7 @@ Store the result in `file_path`.
On construction, the validator receives a pattern for a regular expression.
The pattern variable will be used for constructing an std::regex and the validator will call std::regex_match on the command line argument.
-Note that a regex_match will only return true if the string matches the pattern completely (in contrast to regex_search which also matches substrings). The validator throws a seqan3::parser_invalid_argument exception whenever a given parameter does not match the given regular expression.
+Note that a regex_match will only return true if the string matches the pattern completely (in contrast to regex_search which also matches substrings). The validator throws a seqan3::validation_error exception whenever a given parameter does not match the given regular expression.
\snippet test/snippet/argument_parser/validators_4.cpp validator_call
diff --git a/doc/tutorial/argument_parser/solution3.cpp b/doc/tutorial/argument_parser/solution3.cpp
index b9d80d5d769..37405e0ed9a 100644
--- a/doc/tutorial/argument_parser/solution3.cpp
+++ b/doc/tutorial/argument_parser/solution3.cpp
@@ -102,7 +102,7 @@ int main(int argc, char ** argv)
{
myparser.parse(); // trigger command line parsing
}
- catch (seqan3::parser_invalid_argument const & ext) // catch user errors
+ catch (seqan3::argument_parser_error const & ext) // catch user errors
{
seqan3::debug_stream << "[Winter has come] " << ext.what() << "\n"; // customise your error message
return -1;
diff --git a/doc/tutorial/argument_parser/solution4.cpp b/doc/tutorial/argument_parser/solution4.cpp
index a17cdcb8b53..1b89c23faef 100644
--- a/doc/tutorial/argument_parser/solution4.cpp
+++ b/doc/tutorial/argument_parser/solution4.cpp
@@ -102,7 +102,7 @@ int main(int argc, char ** argv)
{
myparser.parse(); // trigger command line parsing
}
- catch (seqan3::parser_invalid_argument const & ext) // catch user errors
+ catch (seqan3::argument_parser_error const & ext) // catch user errors
{
seqan3::debug_stream << "[Winter has come] " << ext.what() << "\n"; // customise your error message
return -1;
diff --git a/doc/tutorial/argument_parser/solution5.cpp b/doc/tutorial/argument_parser/solution5.cpp
index 45edadc5e72..2cc38210bdc 100644
--- a/doc/tutorial/argument_parser/solution5.cpp
+++ b/doc/tutorial/argument_parser/solution5.cpp
@@ -100,7 +100,7 @@ int main(int argc, char ** argv)
{
myparser.parse(); // trigger command line parsing
}
- catch (seqan3::parser_invalid_argument const & ext) // catch user errors
+ catch (seqan3::argument_parser_error const & ext) // catch user errors
{
seqan3::debug_stream << "[Winter has come] " << ext.what() << "\n"; // customise your error message
return -1;
diff --git a/doc/tutorial/argument_parser/solution6.cpp b/doc/tutorial/argument_parser/solution6.cpp
index cdd5f949b5a..6b7f0341a2f 100644
--- a/doc/tutorial/argument_parser/solution6.cpp
+++ b/doc/tutorial/argument_parser/solution6.cpp
@@ -107,7 +107,7 @@ int main(int argc, char ** argv)
{
myparser.parse(); // trigger command line parsing
}
- catch (seqan3::parser_invalid_argument const & ext) // catch user errors
+ catch (seqan3::argument_parser_error const & ext) // catch user errors
{
seqan3::debug_stream << "[Winter has come] " << ext.what() << "\n"; // customise your error message
return -1;
diff --git a/doc/tutorial/concepts/custom_validator_solution2.cpp b/doc/tutorial/concepts/custom_validator_solution2.cpp
index 521aff5ba73..1b76ac5a3bb 100644
--- a/doc/tutorial/concepts/custom_validator_solution2.cpp
+++ b/doc/tutorial/concepts/custom_validator_solution2.cpp
@@ -11,7 +11,7 @@ struct custom_validator
if ((std::round(val) != val) || // not an integer
(std::pow(std::round(std::sqrt(val)), 2) != val)) // not a square
{
- throw seqan3::parser_invalid_argument{"The provided number is not an arithmetic square."};
+ throw seqan3::validation_error{"The provided number is not an arithmetic square."};
}
}
@@ -42,7 +42,7 @@ int main(int argc, char ** argv)
{
myparser.parse(); // trigger command line parsing
}
- catch (seqan3::parser_invalid_argument const & ext)
+ catch (seqan3::argument_parser_error const & ext)
{
seqan3::debug_stream << ext.what() << '\n';
return -1;
diff --git a/doc/tutorial/concepts/index.md b/doc/tutorial/concepts/index.md
index 34fe609137e..e6d77411425 100644
--- a/doc/tutorial/concepts/index.md
+++ b/doc/tutorial/concepts/index.md
@@ -304,7 +304,7 @@ It should print "Yeah!" for the arguments `-i 0`, `-i 4`, or `-i 144`; and/or `-
It should fail for the arguments `-i 3`; and/or `-j 144` or `-j 3`.
\assignment{Exercise: Custom validator II}
-Implement your validator fully, i.e. make it throw seqan3::parser_invalid_argument if the number provided is not a
+Implement your validator fully, i.e. make it throw seqan3::validation_error if the number provided is not a
square.
Also give a nice description for the help page.
diff --git a/doc/tutorial/introduction/introduction_argument_parser.cpp b/doc/tutorial/introduction/introduction_argument_parser.cpp
index c61fc835fa7..4ca267b97bc 100644
--- a/doc/tutorial/introduction/introduction_argument_parser.cpp
+++ b/doc/tutorial/introduction/introduction_argument_parser.cpp
@@ -16,7 +16,7 @@ int main(int argc, char * argv[])
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext)
+ catch (seqan3::argument_parser_error const & ext)
{
seqan3::debug_stream << "[PARSER ERROR] " << ext.what() << '\n';
return 0;
diff --git a/doc/tutorial/introduction/introduction_read_fasta.cpp b/doc/tutorial/introduction/introduction_read_fasta.cpp
index 6bf27d1583c..47f6dfb31bc 100644
--- a/doc/tutorial/introduction/introduction_read_fasta.cpp
+++ b/doc/tutorial/introduction/introduction_read_fasta.cpp
@@ -15,7 +15,7 @@ int main(int argc, char * argv[])
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext)
+ catch (seqan3::argument_parser_error const & ext)
{
seqan3::debug_stream << "[PARSER ERROR] " << ext.what() << '\n';
return 0;
diff --git a/doc/tutorial/ranges/range_solution4.cpp b/doc/tutorial/ranges/range_solution4.cpp
index f0c24ac802e..29d006d7025 100644
--- a/doc/tutorial/ranges/range_solution4.cpp
+++ b/doc/tutorial/ranges/range_solution4.cpp
@@ -18,7 +18,7 @@ int main(int argc, char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // catch user errors
+ catch (seqan3::argument_parser_error const & ext) // catch user errors
{
seqan3::debug_stream << "[Error] " << ext.what() << "\n";
return -1;
diff --git a/doc/tutorial/read_mapper/read_mapper_indexer_step1.cpp b/doc/tutorial/read_mapper/read_mapper_indexer_step1.cpp
index a6c9b1259a1..179d788723f 100644
--- a/doc/tutorial/read_mapper/read_mapper_indexer_step1.cpp
+++ b/doc/tutorial/read_mapper/read_mapper_indexer_step1.cpp
@@ -39,7 +39,7 @@ int main(int argc, char const ** argv)
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext)
+ catch (seqan3::argument_parser_error const & ext)
{
std::cerr << "[PARSER ERROR] " << ext.what() << '\n';
return -1;
diff --git a/doc/tutorial/read_mapper/read_mapper_indexer_step2.cpp b/doc/tutorial/read_mapper/read_mapper_indexer_step2.cpp
index 1754f609ca5..d46e06e9c72 100644
--- a/doc/tutorial/read_mapper/read_mapper_indexer_step2.cpp
+++ b/doc/tutorial/read_mapper/read_mapper_indexer_step2.cpp
@@ -65,7 +65,7 @@ int main(int argc, char const ** argv)
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext)
+ catch (seqan3::argument_parser_error const & ext)
{
std::cerr << "[PARSER ERROR] " << ext.what() << '\n';
return -1;
diff --git a/doc/tutorial/read_mapper/read_mapper_indexer_step3.cpp b/doc/tutorial/read_mapper/read_mapper_indexer_step3.cpp
index af2ef2ff9d4..055fe4d5ca8 100644
--- a/doc/tutorial/read_mapper/read_mapper_indexer_step3.cpp
+++ b/doc/tutorial/read_mapper/read_mapper_indexer_step3.cpp
@@ -80,7 +80,7 @@ int main(int argc, char const ** argv)
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext)
+ catch (seqan3::argument_parser_error const & ext)
{
std::cerr << "[PARSER ERROR] " << ext.what() << '\n';
return -1;
diff --git a/doc/tutorial/read_mapper/read_mapper_step1.cpp b/doc/tutorial/read_mapper/read_mapper_step1.cpp
index 14e9e39a30f..3466c41a77f 100644
--- a/doc/tutorial/read_mapper/read_mapper_step1.cpp
+++ b/doc/tutorial/read_mapper/read_mapper_step1.cpp
@@ -57,7 +57,7 @@ int main(int argc, char const ** argv)
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext)
+ catch (seqan3::argument_parser_error const & ext)
{
std::cerr << "[PARSER ERROR] " << ext.what() << '\n';
return -1;
diff --git a/doc/tutorial/read_mapper/read_mapper_step2.cpp b/doc/tutorial/read_mapper/read_mapper_step2.cpp
index 69ab858882e..a76f2ce0ae8 100644
--- a/doc/tutorial/read_mapper/read_mapper_step2.cpp
+++ b/doc/tutorial/read_mapper/read_mapper_step2.cpp
@@ -114,7 +114,7 @@ int main(int argc, char const ** argv)
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext)
+ catch (seqan3::argument_parser_error const & ext)
{
std::cerr << "[PARSER ERROR] " << ext.what() << '\n';
return -1;
diff --git a/doc/tutorial/read_mapper/read_mapper_step3.cpp b/doc/tutorial/read_mapper/read_mapper_step3.cpp
index 7fde0cfe1de..a6168ea714a 100644
--- a/doc/tutorial/read_mapper/read_mapper_step3.cpp
+++ b/doc/tutorial/read_mapper/read_mapper_step3.cpp
@@ -132,7 +132,7 @@ int main(int argc, char const ** argv)
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext)
+ catch (seqan3::argument_parser_error const & ext)
{
std::cerr << "[PARSER ERROR] " << ext.what() << '\n';
return -1;
diff --git a/doc/tutorial/read_mapper/read_mapper_step4.cpp b/doc/tutorial/read_mapper/read_mapper_step4.cpp
index a5310b0bee4..d34d2d9825c 100644
--- a/doc/tutorial/read_mapper/read_mapper_step4.cpp
+++ b/doc/tutorial/read_mapper/read_mapper_step4.cpp
@@ -138,7 +138,7 @@ int main(int argc, char const ** argv)
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext)
+ catch (seqan3::argument_parser_error const & ext)
{
std::cerr << "[PARSER ERROR] " << ext.what() << '\n';
return -1;
diff --git a/include/seqan3/argument_parser/argument_parser.hpp b/include/seqan3/argument_parser/argument_parser.hpp
index f51b79ace92..4b5a2d49059 100644
--- a/include/seqan3/argument_parser/argument_parser.hpp
+++ b/include/seqan3/argument_parser/argument_parser.hpp
@@ -114,10 +114,10 @@ namespace seqan3
* Developer errors are those that violate the seqan3::argument_parser design
* (e.g. calling the seqan3::argument_parser::parse function twice or specifying
* two different options with the same identifier.)
- * In this case, a seqan3::parser_design_error is thrown.
+ * In this case, a seqan3::design_error is thrown.
*
* The second kind are user errors, due to invalid command line calls. In this
- * case a seqan3::parser_invalid_argument is thrown.
+ * case a seqan3::argument_parser_error is thrown.
*
* For example:
*
@@ -170,7 +170,7 @@ class argument_parser
* \param[in] version_check Notify users about app version updates (default true).
* \param[in] subcommands A list of subcommands (see \link subcommand_arg_parse subcommand parsing \endlink).
*
- * \throws seqan3::parser_design_error if the application name contains illegal characters.
+ * \throws seqan3::design_error if the application name contains illegal characters.
*
* The application name must only contain alpha-numeric characters, '_' or '-',
* i.e. the following regex must evaluate to true: `\"^[a-zA-Z0-9_-]+$\"`.
@@ -186,11 +186,11 @@ class argument_parser
version_check_dev_decision{version_check}
{
if (!std::regex_match(app_name, app_name_regex))
- throw parser_design_error{"The application name must only contain alpha-numeric characters "
+ throw design_error{"The application name must only contain alpha-numeric characters "
"or '_' and '-' (regex: \"^[a-zA-Z0-9_-]+$\")."};
for (auto & sub : subcommands)
if (!std::regex_match(sub, std::regex{"^[a-zA-Z0-9_]+$"}))
- throw parser_design_error{"The subcommand name must only contain alpha-numeric characters or '_'."};
+ throw design_error{"The subcommand name must only contain alpha-numeric characters or '_'."};
info.app_name = std::move(app_name);
init(argc, argv, std::move(subcommands));
@@ -226,7 +226,7 @@ class argument_parser
* \param[in] spec Advanced option specification, see seqan3::option_spec.
* \param[in] validator The validator applied to the value after parsing (callable).
*
- * \throws seqan3::parser_design_error
+ * \throws seqan3::design_error
*/
template >
//!\cond
@@ -242,7 +242,7 @@ class argument_parser
validator_type validator = validator_type{}) // copy to bind rvalues
{
if (sub_parser != nullptr)
- throw parser_design_error{"You may only specify flags for the top-level parser."};
+ throw design_error{"You may only specify flags for the top-level parser."};
verify_identifiers(short_id, long_id);
// copy variables into the lambda because the calls are pushed to a stack
@@ -272,9 +272,9 @@ class argument_parser
/*!\brief Adds a positional option to the seqan3::argument_parser.
*
- * \tparam option_type Must have a formateted input function (stream >> value).
+ * \tparam option_type Must have a formatted input function (stream >> value).
* If option_type is a container, its value type must have the
- * formateted input function (exception: std::string is not
+ * formatted input function (exception: std::string is not
* regarded as a container).
* See FormattedInputFunction .
* \tparam validator_type The type of validator to be applied to the option
@@ -284,7 +284,7 @@ class argument_parser
* \param[in] desc The description of the positional option to be shown in the help page.
* \param[in] validator The validator applied to the value after parsing (callable).
*
- * \throws seqan3::parser_design_error
+ * \throws seqan3::design_error
*
* \details
*
@@ -301,10 +301,10 @@ class argument_parser
validator_type validator = validator_type{}) // copy to bind rvalues
{
if (sub_parser != nullptr)
- throw parser_design_error{"You may only specify flags for the top-level parser."};
+ throw design_error{"You may only specify flags for the top-level parser."};
if (has_positional_list_option)
- throw parser_design_error{"You added a positional option with a list value before so you cannot add "
+ throw design_error{"You added a positional option with a list value before so you cannot add "
"any other positional options."};
if constexpr (sequence_container && !std::same_as)
@@ -321,17 +321,14 @@ class argument_parser
* \attention The function must be called at the very end of all parser
* related code and should be enclosed in a try catch block.
*
- * \throws seqan3::parser_design_error if this function was already called before.
+ * \throws seqan3::design_error if this function was already called before.
*
* \throws seqan3::option_declared_multiple_times if an option that is not a list was declared multiple times.
- * \throws seqan3::overflow_error_on_conversion if the numeric argument would cause an overflow error when
- * converted into the expected type.
- * \throws seqan3::parser_invalid_argument if the user provided wrong arguments.
+ * \throws seqan3::user_input_error if an incorrect argument is given as (positional) option value.
* \throws seqan3::required_option_missing if the user did not provide a required option.
* \throws seqan3::too_many_arguments if the command line call contained more arguments than expected.
* \throws seqan3::too_few_arguments if the command line call contained less arguments than expected.
- * \throws seqan3::type_conversion_failed if the argument value could not be converted into the expected type.
- * \throws seqan3::validation_failed if the argument was not excepted by the provided validator.
+ * \throws seqan3::validation_error if the argument was not excepted by the provided validator.
*
* \details
*
@@ -389,7 +386,7 @@ class argument_parser
void parse()
{
if (parse_was_called)
- throw parser_design_error("The function parse() must only be called once!");
+ throw design_error("The function parse() must only be called once!");
detail::version_checker app_version{info.app_name, info.version, info.url};
@@ -411,7 +408,7 @@ class argument_parser
{
if (sub_parser == nullptr)
{
- throw parser_design_error("You did not enable subcommand parsing on construction "
+ throw design_error("You did not enable subcommand parsing on construction "
"so you cannot access the sub-parser!");
}
@@ -555,7 +552,11 @@ class argument_parser
* \param[in] argv The command line arguments.
* \param[in] subcommands The subcommand key words to split command line arguments into top-level and sub-parser.
*
- * \throws seqan3::parser_invalid_argument
+ * \throws seqan3::too_few_arguments if option --export-help was specified without a value
+ * \throws seqan3::too_few_arguments if option --version-check was specified without a value
+ * \throws seqan3::validation_error if the value passed to option --export-help was invalid.
+ * \throws seqan3::validation_error if the value passed to option --version-check was invalid.
+ * \throws seqan3::too_few_arguments if a sub parser was configured at construction but a subcommand is missing.
*
* \details
*
@@ -576,7 +577,7 @@ class argument_parser
* - else the format is that to seqan3::detail::format_parse
*
* If `--export-help` is specified with a value other than html/man or ctd
- * a parser_invalid_argument is thrown.
+ * a argument_parser_error is thrown.
*/
void init(int argc, char const * const * const argv, std::vector const & subcommands)
{
@@ -628,7 +629,7 @@ class argument_parser
else
{
if (argv_len <= i + 1)
- throw parser_invalid_argument{"Option --export-help must be followed by a value."};
+ throw too_few_arguments{"Option --export-help must be followed by a value."};
export_format = {argv[i+1]};
}
@@ -640,7 +641,7 @@ class argument_parser
// else if (export_format == "ctd")
// format = detail::format_ctd{};
else
- throw validation_failed{"Validation failed for option --export-help: "
+ throw validation_error{"Validation failed for option --export-help: "
"Value must be one of [html, man]"};
init_standard_options();
special_format_was_set = true;
@@ -653,7 +654,7 @@ class argument_parser
else if (arg == "--version-check")
{
if (++i >= argv_len)
- throw parser_invalid_argument{"Option --version-check must be followed by a value."};
+ throw too_few_arguments{"Option --version-check must be followed by a value."};
arg = argv[i];
@@ -662,7 +663,7 @@ class argument_parser
else if (arg == "0")
version_check_user_decision = false;
else
- throw parser_invalid_argument{"Value for option --version-check must be 1 or 0."};
+ throw validation_error{"Value for option --version-check must be 1 or 0."};
argc -= 2;
}
@@ -676,8 +677,8 @@ class argument_parser
{
if (!subcommands.empty() && sub_parser == nullptr)
{
- throw parser_invalid_argument{detail::to_string("Please specify which sub program you want to use ",
- "(one of ", subcommands, "). Use -h/--help for more information.")};
+ throw too_few_arguments{detail::to_string("Please specify which sub program you want to use ",
+ "(one of ", subcommands, "). Use -h/--help for more information.")};
}
format = detail::format_parse(argc, std::move(argv_new));
@@ -716,7 +717,7 @@ class argument_parser
/*!\brief Verifies that the short and the long identifiers are correctly formatted.
* \param[in] short_id The short identifier of the command line option/flag.
* \param[in] long_id The long identifier of the command line option/flag.
- * \throws seqan3::parser_design_error
+ * \throws seqan3::design_error
* \details Specifically, checks that identifiers haven't been used before,
* the length of long IDs is either empty or longer than one char,
* the characters used in the identifiers are all valid,
@@ -727,23 +728,23 @@ class argument_parser
auto constexpr allowed = is_alnum || is_char<'_'> || is_char<'@'>;
if (id_exists(short_id))
- throw parser_design_error("Option Identifier '" + std::string(1, short_id) + "' was already used before.");
+ throw design_error("Option Identifier '" + std::string(1, short_id) + "' was already used before.");
if (id_exists(long_id))
- throw parser_design_error("Option Identifier '" + long_id + "' was already used before.");
+ throw design_error("Option Identifier '" + long_id + "' was already used before.");
if (long_id.length() == 1)
- throw parser_design_error("Long IDs must be either empty, or longer than one character.");
+ throw design_error("Long IDs must be either empty, or longer than one character.");
if (!allowed(short_id) && !is_char<'\0'>(short_id))
- throw parser_design_error("Option identifiers may only contain alphanumeric characters, '_', or '@'.");
+ throw design_error("Option identifiers may only contain alphanumeric characters, '_', or '@'.");
if (long_id.size() > 0 && is_char<'-'>(long_id[0]))
- throw parser_design_error("First character of long ID cannot be '-'.");
+ throw design_error("First character of long ID cannot be '-'.");
std::for_each(long_id.begin(), long_id.end(), [&allowed] (char c)
{
if (!(allowed(c) || is_char<'-'>(c)))
- throw parser_design_error("Long identifiers may only contain alphanumeric characters, '_', '-', or '@'.");
+ throw design_error("Long identifiers may only contain alphanumeric characters, '_', '-', or '@'.");
});
if (detail::format_parse::is_empty_id(short_id) && detail::format_parse::is_empty_id(long_id))
- throw parser_design_error("Option Identifiers cannot both be empty.");
+ throw design_error("Option Identifiers cannot both be empty.");
}
/*!\brief The format of the argument parser that decides the behavior when
diff --git a/include/seqan3/argument_parser/detail/format_parse.hpp b/include/seqan3/argument_parser/detail/format_parse.hpp
index baf9c7d4b80..e398c678930 100644
--- a/include/seqan3/argument_parser/detail/format_parse.hpp
+++ b/include/seqan3/argument_parser/detail/format_parse.hpp
@@ -81,7 +81,7 @@ class format_parse : public format_base
* \param[in] spec Advanced option specification, see seqan3::option_spec.
* \param[in] validator The validator applied to the value after parsing (callable).
*
- * \throws seqan3::parser_design_error
+ * \throws seqan3::design_error
*/
template
void add_option(option_type & value,
@@ -103,7 +103,7 @@ class format_parse : public format_base
* \param[in] short_id The short identifier for the flag (e.g. 'i').
* \param[in] long_id The long identifier for the flag (e.g. "integer").
*
- * \throws seqan3::parser_design_error
+ * \throws seqan3::design_error
*/
void add_flag(bool & value,
char const short_id,
@@ -125,7 +125,7 @@ class format_parse : public format_base
* \param[out] value The variable in which to store the given command line argument.
* \param[in] validator The validator applied to the value after parsing (callable).
*
- * \throws seqan3::parser_design_error
+ * \throws seqan3::design_error
*/
template
void add_positional_option(option_type & value,
@@ -292,8 +292,10 @@ class format_parse : public format_base
/*!\brief Tries to cast an input string into a value.
* \tparam option_t Must model seqan3::input_stream_over.
- * \param[out] value Stores the casted value.
- * \param[in] in The input argument to be casted.
+ * \param[out] value Stores the cast value.
+ * \param[in] in The input argument to be cast.
+ * \returns seqan3::option_cast_result::type_conversion_error if \p in could not be converted via the stream
+ * operator and otherwise seqan3::option_cast_result::success.
*/
template
//!\cond
@@ -313,6 +315,8 @@ class format_parse : public format_base
* \tparam option_t Must model seqan3::named_enumeration.
* \param[out] value Stores the cast value.
* \param[in] in The input argument to be cast.
+ * \returns seqan3::option_cast_result::type_conversion_error if \p in could not be found in the
+ * seqan3::enumeration_names map and otherwise seqan3::option_cast_result::success.
*/
template
option_cast_result cast_option_value(option_t & value, std::string_view const in)
@@ -335,13 +339,12 @@ class format_parse : public format_base
}
//!\endcond
- /*!\brief Appends a casted value to its container.
- *
- * \tparam container_option_t Must satisfy the seqan3::sequence_container and
- * its value_type must satisfy the seqan3::input_stream_over
- *
- * \param[out] value container that stores the casted value.
- * \param[in] in The input argument to be casted.
+ /*!\brief Appends a cast value to its container.
+ * \tparam container_option_t Must model the seqan3::sequence_container and its value_type must model
+ * seqan3::input_stream_over
+ * \param[out] value container that stores the cast value.
+ * \param[in] in The input argument to be cast.
+ * \returns A seqan3::option_cast_result whether the cast was successful or not.
*/
template
//!\cond
@@ -349,7 +352,7 @@ class format_parse : public format_base
//!\cond
option_cast_result cast_option_value(container_option_t & value, std::string const & in)
{
- typename container_option_t::value_type tmp;
+ typename container_option_t::value_type tmp{};
auto res = cast_option_value(tmp, in); // throws on failure
value.push_back(tmp);
@@ -357,12 +360,12 @@ class format_parse : public format_base
}
/*!\brief Tries to cast an input string into an arithmetic value.
- * \tparam option_t The optiona value type; must model seqan3::arithmetic.
- * \param[out] value Stores the casted value.
- * \param[in] in The input argument to be casted.
- *
- * \throws seqan3::type_conversion_failed
- * \throws seqan3::overflow_error_on_conversion
+ * \tparam option_t The optiona value type; must model seqan3::arithmetic.
+ * \param[out] value Stores the cast value.
+ * \param[in] in The input argument to be cast.
+ * \returns seqan3::option_cast_result::type_conversion_error if \p in could not be converted to an arithmetic type
+ * via std::from_chars, seqan3::option_cast_result::overflow_error if \p in could be converted but the
+ * value is too large for the respective type, and otherwise seqan3::option_cast_result::success.
*
* \details
*
@@ -385,12 +388,14 @@ class format_parse : public format_base
}
/*!\brief Tries to cast an input string into boolean value.
- * \param[out] value Stores the casted value.
- * \param[in] in The input argument to be casted.
+ * \param[out] value Stores the cast value.
+ * \param[in] in The input argument to be cast.
+ * \returns A seqan3::option_cast_result whether the cast was successful or not.
*
* \details
*
- * This function delegates to std::from_chars.
+ * This function accepts the strings "0" or "false" which sets sets \p value to `false` or "1" or "true" which
+ * sets \p value to `true`.
*/
option_cast_result cast_option_value(bool & value, std::string const & in)
{
@@ -413,7 +418,7 @@ class format_parse : public format_base
* \param[in] option_name The name of the option who's input was cast.
* \param[in] input_value The original user input in question.
*
- * \throws seqan3::parser_invalid_argument if \p res was not seqan3::option_cast_result::success.
+ * \throws seqan3::user_input_error if \p res was not seqan3::option_cast_result::success.
*/
template
void throw_on_input_error(option_cast_result const res,
@@ -424,17 +429,17 @@ class format_parse : public format_base
if (res == option_cast_result::conversion_error)
{
- throw parser_invalid_argument{msg + "Argument " + input_value + " could not be cast to type " +
- get_type_name_as_string(input_value) + "."};
+ throw user_input_error{msg + "Argument " + input_value + " could not be cast to type " +
+ get_type_name_as_string(input_value) + "."};
}
if constexpr (arithmetic)
{
if (res == option_cast_result::overflow_error)
{
- throw parser_invalid_argument{msg + "Numeric argument " + input_value + " is not in the valid range [" +
- std::to_string(std::numeric_limits::min()) + "," +
- std::to_string(std::numeric_limits::max()) + "]."};
+ throw user_input_error{msg + "Numeric argument " + input_value + " is not in the valid range [" +
+ std::to_string(std::numeric_limits::min()) + "," +
+ std::to_string(std::numeric_limits::max()) + "]."};
}
}
@@ -443,17 +448,18 @@ class format_parse : public format_base
/*!\brief Handles value retrieval for options based on different kev value pairs.
*
- * \param[out] value Stores the value found in argv, casted by cast_option_value.
+ * \param[out] value Stores the value found in argv, cast by cast_option_value.
* \param[in] option_it The iterator where the option identifier was found.
* \param[in] id The option identifier supplied on the command line.
*
- * \throws seqan3::parser_invalid_argument
+ * \throws seqan3::too_few_arguments if the option was not followed by a value.
+ * \throws seqan3::user_input_error if the given option value was invalid.
*
* \details
*
* The value at option_it is inspected whether it is an '-key value', '-key=value'
* or '-keyValue' pair and the input is extracted accordingly. The input
- * will then be tried to be casted into the `value` parameter.
+ * will then be tried to be cast into the `value` parameter.
*
* Returns true on success and false otherwise.
*/
@@ -472,9 +478,7 @@ class format_parse : public format_base
if ((*option_it)[id_size] == '=') // -key=value
{
if ((*option_it).size() == id_size + 1) // malformed because no value follows '-i='
- throw parser_invalid_argument("Value cast failed for option " +
- prepend_dash(id) +
- ": No value was provided.");
+ throw too_few_arguments("Missing value for option " + prepend_dash(id));
input_value = (*option_it).substr(id_size + 1);
}
else // -kevValue
@@ -489,9 +493,7 @@ class format_parse : public format_base
*option_it = ""; // remove used identifier
++option_it;
if (option_it == end_of_options_it) // should not happen
- throw parser_invalid_argument("Value cast failed for option " +
- prepend_dash(id) +
- ": No value was provided.");
+ throw too_few_arguments("Missing value for option " + prepend_dash(id));
input_value = *option_it;
*option_it = ""; // remove value
}
@@ -506,7 +508,7 @@ class format_parse : public format_base
/*!\brief Handles value retrieval (non container type) options.
*
- * \param[out] value Stores the value found in argv, casted by cast_option_value.
+ * \param[out] value Stores the value found in argv, cast by cast_option_value.
* \param[in] id The option identifier supplied on the command line.
*
* \throws seqan3::option_declared_multiple_times
@@ -514,7 +516,7 @@ class format_parse : public format_base
* \details
*
* If the option identifier is found in format_parse::argv, the value of
- * the following position in argv is tried to be casted into value
+ * the following position in argv is tried to be cast into value
* and the identifier and value argument are removed from argv.
*
* Returns true on success and false otherwise. This is needed to catch
@@ -538,7 +540,7 @@ class format_parse : public format_base
/*!\brief Handles value retrieval (container type) options.
*
- * \param[out] value Stores all values found in argv, casted by cast_option_value.
+ * \param[out] value Stores all values found in argv, cast by cast_option_value.
* \param[in] id The option identifier supplied on the command line.
*
* \details
@@ -633,7 +635,7 @@ class format_parse : public format_base
* \param[in] validator The validator applied to the value after parsing (callable).
*
* \throws seqan3::option_declared_multiple_times
- * \throws seqan3::validation_failed
+ * \throws seqan3::validation_error
* \throws seqan3::required_option_missing
*
* \details
@@ -668,7 +670,7 @@ class format_parse : public format_base
}
catch (std::exception & ex)
{
- throw validation_failed(std::string("Validation failed for option ") +
+ throw validation_error(std::string("Validation failed for option ") +
combine_option_names(short_id, long_id) + ": " + ex.what());
}
}
@@ -700,10 +702,10 @@ class format_parse : public format_base
* \param[out] value The variable in which to store the given command line argument.
* \param[in] validator The validator applied to the value after parsing (callable).
*
- * \throws seqan3::parser_invalid_argument
+ * \throws seqan3::argument_parser_error
* \throws seqan3::too_few_arguments
- * \throws seqan3::validation_failed
- * \throws seqan3::parser_design_error
+ * \throws seqan3::validation_error
+ * \throws seqan3::design_error
*
* \details
*
@@ -729,7 +731,8 @@ class format_parse : public format_base
if (it == argv.end())
throw too_few_arguments("Not enough positional arguments provided (Need at least " +
- std::to_string(positional_option_calls.size()) + "). See -h/--help for more information.");
+ std::to_string(positional_option_calls.size()) +
+ "). See -h/--help for more information.");
if (sequence_container && !std::is_same_v) // vector/list will be filled with all remaining arguments
{
@@ -761,7 +764,7 @@ class format_parse : public format_base
}
catch (std::exception & ex)
{
- throw validation_failed("Validation failed for positional option " +
+ throw validation_error("Validation failed for positional option " +
std::to_string(positional_option_count) + ": " + ex.what());
}
}
diff --git a/include/seqan3/argument_parser/exceptions.hpp b/include/seqan3/argument_parser/exceptions.hpp
index a1cc7374ba2..45bfd1711c4 100644
--- a/include/seqan3/argument_parser/exceptions.hpp
+++ b/include/seqan3/argument_parser/exceptions.hpp
@@ -19,6 +19,17 @@
namespace seqan3
{
+//!\brief This class is eprecated.
+//!\deprecated Use seqan3::argument_parser_error instead.
+class SEQAN3_DEPRECATED_310 parser_invalid_argument : public std::invalid_argument
+{
+public:
+ /*!\brief The constructor.
+ * \param[in] s The error message.
+ */
+ parser_invalid_argument(std::string const & s) : std::invalid_argument(s) {}
+};
+
/*!\brief Argument parser exception that is thrown whenever there is an error
* while parsing the command line arguments.
*
@@ -34,93 +45,83 @@ namespace seqan3
* - Type conversion failed
* - Validation failed (as defined by the developer)
*/
-class parser_invalid_argument : public std::invalid_argument
-{
-public:
- /*!\brief The constructor.
- * \param[in] s The error message.
- */
- parser_invalid_argument(std::string const & s) : std::invalid_argument(s) {}
-};
-
-//!\brief Argument parser exception thrown when encountering unknown option.
-class unknown_option : public parser_invalid_argument
+class argument_parser_error : public std::invalid_argument
{
public:
/*!\brief The constructor.
* \param[in] s The error message.
*/
- unknown_option(std::string const & s) : parser_invalid_argument(s) {}
+ argument_parser_error(std::string const & s) : std::invalid_argument(s) {}
};
-//!\brief Argument parser exception thrown when too many arguments are provided.
-class too_many_arguments : public parser_invalid_argument
+//!\brief Argument parser exception thrown when an incorrect argument is given as (positional) option value.
+class user_input_error : public argument_parser_error
{
public:
/*!\brief The constructor.
* \param[in] s The error message.
*/
- too_many_arguments(std::string const & s) : parser_invalid_argument(s) {}
+ user_input_error(std::string const & s) : argument_parser_error(s) {}
};
-//!\brief Argument parser exception thrown when too few arguments are provided.
-class too_few_arguments : public parser_invalid_argument
+//!\brief Argument parser exception thrown when encountering unknown option.
+class unknown_option : public argument_parser_error
{
public:
/*!\brief The constructor.
* \param[in] s The error message.
*/
- too_few_arguments(std::string const & s) : parser_invalid_argument(s) {}
+ unknown_option(std::string const & s) : argument_parser_error(s) {}
};
-//!\brief Argument parser exception thrown when a required option is missing.
-class required_option_missing : public parser_invalid_argument
+//!\brief Argument parser exception thrown when too many arguments are provided.
+class too_many_arguments : public argument_parser_error
{
public:
/*!\brief The constructor.
* \param[in] s The error message.
*/
- required_option_missing(std::string const & s) : parser_invalid_argument(s) {}
+ too_many_arguments(std::string const & s) : argument_parser_error(s) {}
};
-//!\brief Argument parser exception thrown when a non-list option is declared multiple times.
-class option_declared_multiple_times : public parser_invalid_argument
+//!\brief Argument parser exception thrown when too few arguments are provided.
+class too_few_arguments : public argument_parser_error
{
public:
/*!\brief The constructor.
* \param[in] s The error message.
*/
- option_declared_multiple_times(std::string const & s) : parser_invalid_argument(s) {}
+ too_few_arguments(std::string const & s) : argument_parser_error(s) {}
};
-//!\brief Argument parser exception thrown when an argument could not be casted to the according type.
-class type_conversion_failed : public parser_invalid_argument
+//!\brief Argument parser exception thrown when a required option is missing.
+class required_option_missing : public argument_parser_error
{
public:
/*!\brief The constructor.
* \param[in] s The error message.
*/
- type_conversion_failed(std::string const & s) : parser_invalid_argument(s) {}
+ required_option_missing(std::string const & s) : argument_parser_error(s) {}
};
-//!\brief Argument parser exception thrown when an argument could not be casted to the according type.
-class overflow_error_on_conversion : public parser_invalid_argument
+//!\brief Argument parser exception thrown when a non-list option is declared multiple times.
+class option_declared_multiple_times : public argument_parser_error
{
public:
/*!\brief The constructor.
* \param[in] s The error message.
*/
- overflow_error_on_conversion(std::string const & s) : parser_invalid_argument(s) {}
+ option_declared_multiple_times(std::string const & s) : argument_parser_error(s) {}
};
//!\brief Argument parser exception thrown when an argument could not be casted to the according type.
-class validation_failed : public parser_invalid_argument
+class validation_error : public argument_parser_error
{
public:
/*!\brief The constructor.
* \param[in] s The error message.
*/
- validation_failed(std::string const & s) : parser_invalid_argument(s) {}
+ validation_error(std::string const & s) : argument_parser_error(s) {}
};
/*!\brief Argument parser exception that is thrown whenever there is an design
@@ -133,13 +134,13 @@ class validation_failed : public parser_invalid_argument
* - Reuse of a short or long identifier (must be unique)
* - Both identifiers must not be empty (one is ok)
*/
-class parser_design_error : public std::logic_error
+class design_error : public std::logic_error
{
public:
/*!\brief The constructor.
* \param[in] s The error message.
*/
- parser_design_error(std::string const & s) : std::logic_error(s) {}
+ design_error(std::string const & s) : std::logic_error(s) {}
};
} // namespace seqan3
diff --git a/include/seqan3/argument_parser/validators.hpp b/include/seqan3/argument_parser/validators.hpp
index ed2a380ebc6..9e5ba7f3ce1 100644
--- a/include/seqan3/argument_parser/validators.hpp
+++ b/include/seqan3/argument_parser/validators.hpp
@@ -60,11 +60,11 @@ namespace seqan3
* will provide an implementation).
*/
/*!\fn void operator()(option_value_type const & cmp) const
- * \brief Validates the value 'cmp' and throws a seqan3::validation_failed on failure.
+ * \brief Validates the value 'cmp' and throws a seqan3::validation_error on failure.
* \tparam option_value_type The type of the value to be validated.
* \param[in,out] cmp The value to be validated.
* \relates seqan3::validator
- * \throws seqan3::validation_failed if value 'cmp' does not pass validation.
+ * \throws seqan3::validation_error if value 'cmp' does not pass validation.
*
* \details
* \attention This is a concept requirement, not an actual function (however types satisfying this concept
@@ -100,7 +100,7 @@ SEQAN3_CONCEPT validator = std::copyable> &&
* \details
*
* On construction, the validator must receive a maximum and a minimum number.
- * The struct than acts as a functor, that throws a seqan3::parser_invalid_argument
+ * The class than acts as a functor, that throws a seqan3::validation_error
* exception whenever a given value does not lie inside the given min/max range.
*
* \include test/snippet/argument_parser/validators_1.cpp
@@ -121,19 +121,19 @@ class arithmetic_range_validator
/*!\brief Tests whether cmp lies inside [`min`, `max`].
* \param cmp The input value to check.
- * \throws parser_invalid_argument
+ * \throws seqan3::validation_error
*/
void operator()(option_value_type const & cmp) const
{
if (!((cmp <= max) && (cmp >= min)))
- throw parser_invalid_argument(detail::to_string("Value ", cmp, " is not in range [", min, ",", max, "]."));
+ throw validation_error{detail::to_string("Value ", cmp, " is not in range [", min, ",", max, "].")};
}
/*!\brief Tests whether every element in \p range lies inside [`min`, `max`].
* \tparam range_type The type of range to check; must model std::ranges::forward_range. The value type must model
* seqan3::arithmetic.
* \param range The input range to iterate over and check every element.
- * \throws parser_invalid_argument
+ * \throws seqan3::validation_error
*/
template
//!\cond
@@ -166,7 +166,7 @@ class arithmetic_range_validator
* \details
*
* On construction, the validator must receive a range or parameter pack of valid values.
- * The struct than acts as a functor, that throws a seqan3::parser_invalid_argument
+ * The class than acts as a functor, that throws a seqan3::validation_error
* exception whenever a given value is not in the given list.
*
* \note In order to simplify the chaining of validators, the option value type is deduced to `double` for ranges whose
@@ -224,18 +224,18 @@ class value_list_validator
/*!\brief Tests whether cmp lies inside values.
* \param cmp The input value to check.
- * \throws parser_invalid_argument
+ * \throws seqan3::validation_error
*/
void operator()(option_value_type const & cmp) const
{
if (!(std::find(values.begin(), values.end(), cmp) != values.end()))
- throw parser_invalid_argument(detail::to_string("Value ", cmp, " is not one of ", std::views::all(values), "."));
+ throw validation_error{detail::to_string("Value ", cmp, " is not one of ", std::views::all(values), ".")};
}
/*!\brief Tests whether every element in \p range lies inside values.
* \tparam range_type The type of range to check; must model std::ranges::forward_range.
* \param range The input range to iterate over and check every element.
- * \throws parser_invalid_argument
+ * \throws seqan3::validation_error
*/
template
//!\cond
@@ -340,7 +340,7 @@ class file_validator_base
* \tparam range_type The type of range to check; must model std::ranges::forward_range and the value type must
* be convertible to std::filesystem::path.
* \param v The input range to iterate over and check every element.
- * \throws parser_invalid_argument
+ * \throws seqan3::validation_error
*/
template
//!\cond
@@ -355,7 +355,7 @@ class file_validator_base
/*!\brief Validates the given filename path based on the specified extensions.
* \param path The filename path.
- * \throws parser_invalid_argument if the specified extensions don't match the given path, or
+ * \throws seqan3::validation_error if the specified extensions don't match the given path, or
* std::filesystem::filesystem_error on underlying OS API errors.
*/
void validate_filename(std::filesystem::path const & path) const
@@ -366,7 +366,7 @@ class file_validator_base
// Check if extension is available.
if (!path.has_extension())
- throw parser_invalid_argument{detail::to_string("The given filename ", path.string(),
+ throw validation_error{detail::to_string("The given filename ", path.string(),
" has no extension. Expected one of the following valid"
" extensions:", extensions, "!")};
@@ -383,7 +383,7 @@ class file_validator_base
// Check if requested extension is present.
if (std::ranges::find_if(extensions, cmp_lambda) == extensions.end())
{
- throw parser_invalid_argument{detail::to_string("Expected one of the following valid extensions: ",
+ throw validation_error{detail::to_string("Expected one of the following valid extensions: ",
extensions, "! Got ", drop_less_ext, " instead!")};
}
}
@@ -391,7 +391,7 @@ class file_validator_base
/*!\brief Checks if the given path is readable.
* \param path The path to check.
* \returns `true` if readable, otherwise `false`.
- * \throws seqan3::parser_invalid_argument if the path is not readable, or
+ * \throws seqan3::validation_error if the path is not readable, or
* std::filesystem::filesystem_error on underlying OS API errors.
*/
void validate_readability(std::filesystem::path const & path) const
@@ -402,24 +402,24 @@ class file_validator_base
std::error_code ec{};
std::filesystem::directory_iterator{path, ec}; // if directory iterator cannot be created, ec will be set.
if (static_cast(ec))
- throw parser_invalid_argument{detail::to_string("Cannot read the directory ", path ,"!")};
+ throw validation_error{detail::to_string("Cannot read the directory ", path ,"!")};
}
else
{
// Must be a regular file.
if (!std::filesystem::is_regular_file(path))
- throw parser_invalid_argument{detail::to_string("Expected a regular file ", path, "!")};
+ throw validation_error{detail::to_string("Expected a regular file ", path, "!")};
std::ifstream file{path};
if (!file.is_open() || !file.good())
- throw parser_invalid_argument{detail::to_string("Cannot read the file ", path, "!")};
+ throw validation_error{detail::to_string("Cannot read the file ", path, "!")};
}
}
/*!\brief Checks if the given path is writable.
* \param path The path to check.
* \returns `true` if writable, otherwise `false`.
- * \throws seqan3::parser_invalid_argument if the file could not be opened for writing, or
+ * \throws seqan3::validation_error if the file could not be opened for writing, or
* std::filesystem::filesystem_error on underlying OS API errors.
*/
void validate_writeability(std::filesystem::path const & path) const
@@ -432,7 +432,7 @@ class file_validator_base
file.close();
if (!is_good || !is_open)
- throw parser_invalid_argument(detail::to_string("Cannot write ", path, "!"));
+ throw validation_error{detail::to_string("Cannot write ", path, "!")};
file_guard.remove();
}
@@ -449,7 +449,7 @@ class file_validator_base
* \details
*
* On construction, the validator can receive a list (std::vector over std::string) of valid file extensions.
- * The struct acts as a functor that throws a seqan3::parser_invalid_argument exception whenever a given filename's
+ * The class acts as a functor that throws a seqan3::validation_error exception whenever a given filename's
* extension (std::filesystem::path) is not in the given list of valid file extensions, if the file does not exist, or
* if the file does not have the proper read permissions.
*
@@ -524,7 +524,7 @@ class input_file_validator : public file_validator_base
/*!\brief Tests whether path is an existing regular file and is readable.
* \param file The input value to check.
- * \throws parser_invalid_argument if the validation process failed. Might be nested with
+ * \throws seqan3::validation_error if the validation process failed. Might be nested with
* std::filesystem::filesystem_error on unhandled OS API errors.
*/
virtual void operator()(std::filesystem::path const & file) const override
@@ -532,7 +532,7 @@ class input_file_validator : public file_validator_base
try
{
if (!std::filesystem::exists(file))
- throw parser_invalid_argument(detail::to_string("The file ", file, " does not exist!"));
+ throw validation_error{detail::to_string("The file ", file, " does not exist!")};
// Check if file is regular and can be opened for reading.
validate_readability(file);
@@ -542,7 +542,7 @@ class input_file_validator : public file_validator_base
}
catch (std::filesystem::filesystem_error & ex)
{
- std::throw_with_nested(parser_invalid_argument("Unhandled filesystem error!"));
+ std::throw_with_nested(validation_error{"Unhandled filesystem error!"});
}
catch (...)
{
@@ -567,7 +567,7 @@ class input_file_validator : public file_validator_base
* \details
*
* On construction, the validator can receive a list (std::vector over std::string) of valid file extensions.
- * The struct acts as a functor that throws a seqan3::parser_invalid_argument exception whenever a given filename's
+ * The class acts as a functor that throws a seqan3::validation_error exception whenever a given filename's
* extension (sts::string) is not in the given list of valid file extensions, if the file already exist, or if the
* parent path does not have the proper writer permissions.
*
@@ -628,7 +628,7 @@ class output_file_validator : public file_validator_base
/*!\brief Tests whether path is does not already exists and is writable.
* \param file The input value to check.
- * \throws parser_invalid_argument if the validation process failed. Might be nested with
+ * \throws seqan3::validation_error if the validation process failed. Might be nested with
* std::filesystem::filesystem_error on unhandled OS API errors.
*/
virtual void operator()(std::filesystem::path const & file) const override
@@ -636,7 +636,7 @@ class output_file_validator : public file_validator_base
try
{
if (std::filesystem::exists(file))
- throw parser_invalid_argument(detail::to_string("The file ", file, " already exists!"));
+ throw validation_error{detail::to_string("The file ", file, " already exists!")};
// Check if file has any write permissions.
validate_writeability(file);
@@ -645,7 +645,7 @@ class output_file_validator : public file_validator_base
}
catch (std::filesystem::filesystem_error & ex)
{
- std::throw_with_nested(parser_invalid_argument("Unhandled filesystem error!"));
+ std::throw_with_nested(validation_error{"Unhandled filesystem error!"});
}
catch (...)
{
@@ -668,7 +668,7 @@ class output_file_validator : public file_validator_base
*
* \details
*
- * The struct acts as a functor that throws a seqan3::parser_invalid_argument exception whenever a given directory
+ * The class acts as a functor that throws a seqan3::validation_error exception whenever a given directory
* (std::filesystem::path) does not exist, the specified path is not a directory, or if the directory is not
* readable.
*
@@ -701,7 +701,7 @@ class input_directory_validator : public file_validator_base
/*!\brief Tests whether path is an existing directory and is readable.
* \param dir The input value to check.
- * \throws seqan3::parser_invalid_argument if the validation process failed. Might be nested with
+ * \throws seqan3::validation_error if the validation process failed. Might be nested with
* std::filesystem::filesystem_error on unhandled OS API errors.
*/
virtual void operator()(std::filesystem::path const & dir) const override
@@ -709,17 +709,17 @@ class input_directory_validator : public file_validator_base
try
{
if (!std::filesystem::exists(dir))
- throw parser_invalid_argument(detail::to_string("The directory ", dir, " does not exists!"));
+ throw validation_error{detail::to_string("The directory ", dir, " does not exists!")};
if (!std::filesystem::is_directory(dir))
- throw parser_invalid_argument(detail::to_string("The path ", dir, " is not a directory!"));
+ throw validation_error{detail::to_string("The path ", dir, " is not a directory!")};
// Check if directory has any read permissions.
validate_readability(dir);
}
catch (std::filesystem::filesystem_error & ex)
{
- std::throw_with_nested(parser_invalid_argument("Unhandled filesystem error!"));
+ std::throw_with_nested(validation_error{"Unhandled filesystem error!"});
}
catch (...)
{
@@ -740,8 +740,8 @@ class input_directory_validator : public file_validator_base
*
* \details
*
- * The struct acts as a functor that throws a seqan3::parser_invalid_argument exception whenever a given path
- * (std::filesystem::path) is not writable. This can happen if either the parent path does not exists, or the
+ * The class acts as a functor that throws a seqan3::validation_error exception whenever a given path
+ * (std::filesystem::path) is not writeable. This can happen if either the parent path does not exists, or the
* path doesn't have the proper write permissions.
*
* \include test/snippet/argument_parser/validators_output_directory.cpp
@@ -773,7 +773,7 @@ class output_directory_validator : public file_validator_base
/*!\brief Tests whether path is writable.
* \param dir The input value to check.
- * \throws parser_invalid_argument if the validation process failed. Might be nested with
+ * \throws seqan3::validation_error if the validation process failed. Might be nested with
* std::filesystem::filesystem_error on unhandled OS API errors.
*/
virtual void operator()(std::filesystem::path const & dir) const override
@@ -784,7 +784,7 @@ class output_directory_validator : public file_validator_base
std::filesystem::create_directory(dir, ec); // does nothing and is not treated as error if path already exists.
// if error code was set or if dummy.txt could not be created within the output dir, throw an error.
if (static_cast(ec))
- throw parser_invalid_argument(detail::to_string("Cannot create directory: ", dir, "!"));
+ throw validation_error{detail::to_string("Cannot create directory: ", dir, "!")};
try
{
@@ -801,7 +801,7 @@ class output_directory_validator : public file_validator_base
}
catch (std::filesystem::filesystem_error & ex)
{
- std::throw_with_nested(parser_invalid_argument("Unhandled filesystem error!"));
+ std::throw_with_nested(validation_error{"Unhandled filesystem error!"});
}
catch (...)
{
@@ -828,7 +828,7 @@ class output_directory_validator : public file_validator_base
* Note: A regex_match will only return true if the strings matches the pattern
* completely (in contrast to regex_search which also matches substrings).
*
- * The struct than acts as a functor, that throws a seqan3::parser_invalid_argument
+ * The class than acts as a functor, that throws a seqan3::validation_error
* exception whenever string does not match the pattern.
*
* \include test/snippet/argument_parser/validators_4.cpp
@@ -848,20 +848,20 @@ class regex_validator
/*!\brief Tests whether cmp lies inside values.
* \param[in] cmp The value to validate.
- * \throws parser_invalid_argument
+ * \throws seqan3::validation_error
*/
void operator()(option_value_type const & cmp) const
{
std::regex rgx(pattern);
if (!std::regex_match(cmp, rgx))
- throw parser_invalid_argument(detail::to_string("Value ", cmp, " did not match the pattern ", pattern, "."));
+ throw validation_error{detail::to_string("Value ", cmp, " did not match the pattern ", pattern, ".")};
}
/*!\brief Tests whether every filename in list v matches the pattern.
* \tparam range_type The type of range to check; must model std::ranges::forward_range and the value type must
* be convertible to std::string.
* \param v The input range to iterate over and check every element.
- * \throws parser_invalid_argument
+ * \throws seqan3::validation_error
*/
template
//!\cond
diff --git a/test/snippet/argument_parser/argument_parser_1.cpp b/test/snippet/argument_parser/argument_parser_1.cpp
index c177de34182..926d827e371 100644
--- a/test/snippet/argument_parser/argument_parser_1.cpp
+++ b/test/snippet/argument_parser/argument_parser_1.cpp
@@ -17,7 +17,7 @@ int main(int argc, char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/argument_parser_2.cpp b/test/snippet/argument_parser/argument_parser_2.cpp
index 41bbe1eeeb6..bd783a02008 100644
--- a/test/snippet/argument_parser/argument_parser_2.cpp
+++ b/test/snippet/argument_parser/argument_parser_2.cpp
@@ -13,7 +13,7 @@ int main(int argc, char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "The-Age-App - [PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/argument_parser_3.cpp b/test/snippet/argument_parser/argument_parser_3.cpp
index f6478115de5..2aae30a46b0 100644
--- a/test/snippet/argument_parser/argument_parser_3.cpp
+++ b/test/snippet/argument_parser/argument_parser_3.cpp
@@ -27,7 +27,7 @@ int main(int argc, char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << ext.what() << "\n";
return -1;
diff --git a/test/snippet/argument_parser/custom_argument_parsing_enumeration.cpp b/test/snippet/argument_parser/custom_argument_parsing_enumeration.cpp
index d1c076df269..dfb3c12b59c 100644
--- a/test/snippet/argument_parser/custom_argument_parsing_enumeration.cpp
+++ b/test/snippet/argument_parser/custom_argument_parsing_enumeration.cpp
@@ -37,7 +37,7 @@ int main(int argc, char const * argv[])
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/custom_enumeration.cpp b/test/snippet/argument_parser/custom_enumeration.cpp
index a0a7be5274e..ef72ee2fddb 100644
--- a/test/snippet/argument_parser/custom_enumeration.cpp
+++ b/test/snippet/argument_parser/custom_enumeration.cpp
@@ -35,7 +35,7 @@ int main(int argc, char const * argv[])
{
parser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/validators_1.cpp b/test/snippet/argument_parser/validators_1.cpp
index 2bffb32514c..9e8983ba505 100644
--- a/test/snippet/argument_parser/validators_1.cpp
+++ b/test/snippet/argument_parser/validators_1.cpp
@@ -19,7 +19,7 @@ int main(int argc, const char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/validators_2.cpp b/test/snippet/argument_parser/validators_2.cpp
index f18a5efb59c..643bb9dc7bb 100644
--- a/test/snippet/argument_parser/validators_2.cpp
+++ b/test/snippet/argument_parser/validators_2.cpp
@@ -19,7 +19,7 @@ int main(int argc, const char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/validators_3.cpp b/test/snippet/argument_parser/validators_3.cpp
index b2b94c649d7..7e98828a868 100644
--- a/test/snippet/argument_parser/validators_3.cpp
+++ b/test/snippet/argument_parser/validators_3.cpp
@@ -20,7 +20,7 @@ int main(int argc, const char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/validators_4.cpp b/test/snippet/argument_parser/validators_4.cpp
index dc3b21c9393..c3ae9f19861 100644
--- a/test/snippet/argument_parser/validators_4.cpp
+++ b/test/snippet/argument_parser/validators_4.cpp
@@ -19,7 +19,7 @@ int main(int argc, const char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/validators_chaining.cpp b/test/snippet/argument_parser/validators_chaining.cpp
index 0b4c10012f5..706b5e3cb59 100644
--- a/test/snippet/argument_parser/validators_chaining.cpp
+++ b/test/snippet/argument_parser/validators_chaining.cpp
@@ -21,7 +21,7 @@ int main(int argc, const char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/validators_input_directory.cpp b/test/snippet/argument_parser/validators_input_directory.cpp
index 99e57d5f286..9465317218e 100644
--- a/test/snippet/argument_parser/validators_input_directory.cpp
+++ b/test/snippet/argument_parser/validators_input_directory.cpp
@@ -19,7 +19,7 @@ int main(int argc, const char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/validators_input_file.cpp b/test/snippet/argument_parser/validators_input_file.cpp
index 25d497cccf4..dfccd73e90b 100644
--- a/test/snippet/argument_parser/validators_input_file.cpp
+++ b/test/snippet/argument_parser/validators_input_file.cpp
@@ -19,7 +19,7 @@ int main(int argc, const char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/validators_output_directory.cpp b/test/snippet/argument_parser/validators_output_directory.cpp
index 4e7b1c0b2d3..da7bab3511b 100644
--- a/test/snippet/argument_parser/validators_output_directory.cpp
+++ b/test/snippet/argument_parser/validators_output_directory.cpp
@@ -19,7 +19,7 @@ int main(int argc, const char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/snippet/argument_parser/validators_output_file.cpp b/test/snippet/argument_parser/validators_output_file.cpp
index dea15af1b9b..105cb219655 100644
--- a/test/snippet/argument_parser/validators_output_file.cpp
+++ b/test/snippet/argument_parser/validators_output_file.cpp
@@ -20,7 +20,7 @@ int main(int argc, const char ** argv)
{
myparser.parse();
}
- catch (seqan3::parser_invalid_argument const & ext) // the user did something wrong
+ catch (seqan3::argument_parser_error const & ext) // the user did something wrong
{
std::cerr << "[PARSER ERROR] " << ext.what() << "\n"; // customize your error message
return -1;
diff --git a/test/unit/argument_parser/argument_parser_design_error_test.cpp b/test/unit/argument_parser/argument_parser_design_error_test.cpp
index 9281ffae7e0..6162af157b9 100644
--- a/test/unit/argument_parser/argument_parser_design_error_test.cpp
+++ b/test/unit/argument_parser/argument_parser_design_error_test.cpp
@@ -11,20 +11,20 @@
using namespace seqan3;
-TEST(parser_design_error, app_name_validation)
+TEST(design_error, app_name_validation)
{
const char * argv[] = {"./argument_parser_test"};
EXPECT_NO_THROW((argument_parser{"test_parser", 1, argv}));
EXPECT_NO_THROW((argument_parser{"test-parser1234_foo", 1, argv}));
- EXPECT_THROW((argument_parser{"test parser", 1, argv}), parser_design_error);
- EXPECT_THROW((argument_parser{"test;", 1, argv}), parser_design_error);
- EXPECT_THROW((argument_parser{";", 1, argv}), parser_design_error);
- EXPECT_THROW((argument_parser{"test;bad script:D", 1, argv}), parser_design_error);
+ EXPECT_THROW((argument_parser{"test parser", 1, argv}), design_error);
+ EXPECT_THROW((argument_parser{"test;", 1, argv}), design_error);
+ EXPECT_THROW((argument_parser{";", 1, argv}), design_error);
+ EXPECT_THROW((argument_parser{"test;bad script:D", 1, argv}), design_error);
}
-TEST(parse_test, parser_design_error)
+TEST(parse_test, design_error)
{
int option_value;
@@ -33,18 +33,18 @@ TEST(parse_test, parser_design_error)
argument_parser parser{"test_parser", 1, argv};
parser.add_option(option_value, 'i', "int", "this is a int option.");
EXPECT_THROW(parser.add_option(option_value, 'i', "aint", "oh oh same id."),
- parser_design_error);
+ design_error);
// long option
argument_parser parser2{"test_parser", 1, argv};
parser2.add_option(option_value, 'i', "int", "this is an int option.");
EXPECT_THROW(parser2.add_option(option_value, 'a', "int", "oh oh another id."),
- parser_design_error);
+ design_error);
// empty identifier
argument_parser parser3{"test_parser", 1, argv};
EXPECT_THROW(parser3.add_option(option_value, '\0', "", "oh oh all is empty."),
- parser_design_error);
+ design_error);
bool flag_value;
@@ -52,52 +52,52 @@ TEST(parse_test, parser_design_error)
argument_parser parser4{"test_parser", 1, argv};
parser4.add_flag(flag_value, 'i', "int1", "this is an int option.");
EXPECT_THROW(parser4.add_flag(flag_value, 'i', "int2", "oh oh another id."),
- parser_design_error);
+ design_error);
// long flag
argument_parser parser5{"test_parser", 1, argv};
parser5.add_flag(flag_value, 'i', "int", "this is an int option.");
EXPECT_THROW(parser5.add_flag(flag_value, 'a', "int", "oh oh another id."),
- parser_design_error);
+ design_error);
// empty identifier
argument_parser parser6{"test_parser", 1, argv};
EXPECT_THROW(parser6.add_flag(flag_value, '\0', "", "oh oh another id."),
- parser_design_error);
+ design_error);
// positional option not at the end
const char * argv2[] = {"./argument_parser_test", "arg1", "arg2", "arg3"};
std::vector vec;
argument_parser parser7{"test_parser", 4, argv2};
parser7.add_positional_option(vec, "oh oh list not at the end.");
- EXPECT_THROW(parser7.add_positional_option(option_value, "desc."), parser_design_error);
+ EXPECT_THROW(parser7.add_positional_option(option_value, "desc."), design_error);
// using h, help, advanced-help, and export-help
argument_parser parser8{"test_parser", 1, argv};
EXPECT_THROW(parser8.add_option(option_value, 'h', "", "-h is bad."),
- parser_design_error);
+ design_error);
EXPECT_THROW(parser8.add_option(option_value, '\0', "help", "help is bad."),
- parser_design_error);
+ design_error);
EXPECT_THROW(parser8.add_option(option_value, '\0', "advanced-help",
- "advanced-help is bad"), parser_design_error);
+ "advanced-help is bad"), design_error);
EXPECT_THROW(parser8.add_option(option_value, '\0', "export-help",
- "export-help is bad"), parser_design_error);
+ "export-help is bad"), design_error);
// using one-letter long identifiers.
argument_parser parser9{"test_parser", 1, argv};
EXPECT_THROW(parser9.add_option(option_value, 'y', "z", "long identifier is one letter"),
- parser_design_error);
+ design_error);
EXPECT_THROW(parser9.add_flag(flag_value, 'y', "z", "long identifier is one letter"),
- parser_design_error);
+ design_error);
// using non-printable characters
argument_parser parser10{"test_parser", 1, argv};
EXPECT_THROW(parser10.add_option(option_value, '\t', "no\n", "tab and newline don't work!"),
- parser_design_error);
+ design_error);
EXPECT_THROW(parser10.add_flag(flag_value, 'i', "no\n", "tab and newline don't work!"),
- parser_design_error);
+ design_error);
EXPECT_THROW(parser10.add_flag(flag_value, 'a', "-no", "can't start long_id with a hyphen"),
- parser_design_error);
+ design_error);
}
TEST(parse_test, parse_called_twice)
@@ -113,7 +113,7 @@ TEST(parse_test, parse_called_twice)
EXPECT_TRUE((testing::internal::GetCapturedStderr()).empty());
EXPECT_EQ(option_value, "option_string");
- EXPECT_THROW(parser.parse(), parser_design_error);
+ EXPECT_THROW(parser.parse(), design_error);
}
TEST(parse_test, subcommand_argument_parser_error)
@@ -129,14 +129,14 @@ TEST(parse_test, subcommand_argument_parser_error)
EXPECT_NO_THROW(top_level_parser.parse());
EXPECT_EQ(true, flag_value);
- EXPECT_THROW(top_level_parser.get_sub_parser(), parser_design_error);
+ EXPECT_THROW(top_level_parser.get_sub_parser(), design_error);
}
// subcommand key word must only contain alpha numeric characters
{
const char * argv[]{"./top_level", "-f"};
- EXPECT_THROW((argument_parser{"top_level", 2, argv, false, {"with space"}}), parser_design_error);
- EXPECT_THROW((argument_parser{"top_level", 2, argv, false, {"-dash"}}), parser_design_error);
+ EXPECT_THROW((argument_parser{"top_level", 2, argv, false, {"with space"}}), design_error);
+ EXPECT_THROW((argument_parser{"top_level", 2, argv, false, {"-dash"}}), design_error);
}
// no positional/options are allowed
@@ -144,7 +144,7 @@ TEST(parse_test, subcommand_argument_parser_error)
const char * argv[]{"./top_level", "foo"};
argument_parser top_level_parser{"top_level", 2, argv, false, {"foo"}};
- EXPECT_THROW((top_level_parser.add_option(flag_value, 'f', "foo", "foo bar")), parser_design_error);
- EXPECT_THROW((top_level_parser.add_positional_option(flag_value, "foo bar")), parser_design_error);
+ EXPECT_THROW((top_level_parser.add_option(flag_value, 'f', "foo", "foo bar")), design_error);
+ EXPECT_THROW((top_level_parser.add_positional_option(flag_value, "foo bar")), design_error);
}
}
diff --git a/test/unit/argument_parser/detail/format_html_test.cpp b/test/unit/argument_parser/detail/format_html_test.cpp
index 36dfe9ecaab..dd67f66d7ab 100644
--- a/test/unit/argument_parser/detail/format_html_test.cpp
+++ b/test/unit/argument_parser/detail/format_html_test.cpp
@@ -189,11 +189,11 @@ TEST(export_help, parse_error)
const char * argv3[] = {"./help_add_test --version-check 0", "--export-help", "atml"};
// no value after --export-help
- EXPECT_THROW((argument_parser{"test_parser", 2, argv}), parser_invalid_argument);
+ EXPECT_THROW((argument_parser{"test_parser", 2, argv}), argument_parser_error);
// wrong value after --export-help
- EXPECT_THROW((argument_parser{"test_parser", 2, argv2}), validation_failed);
+ EXPECT_THROW((argument_parser{"test_parser", 2, argv2}), validation_error);
// wrong value after --export-help
- EXPECT_THROW((argument_parser{"test_parser", 3, argv3}), validation_failed);
+ EXPECT_THROW((argument_parser{"test_parser", 3, argv3}), validation_error);
}
diff --git a/test/unit/argument_parser/format_parse_test.cpp b/test/unit/argument_parser/format_parse_test.cpp
index 42db5b9d19e..70a5688b120 100644
--- a/test/unit/argument_parser/format_parse_test.cpp
+++ b/test/unit/argument_parser/format_parse_test.cpp
@@ -385,28 +385,28 @@ TEST(parse_test, empty_value_error)
argument_parser parser{"test_parser", 2, argv, false};
parser.add_option(option_value, 'i', "long", "this is a int option.");
- EXPECT_THROW(parser.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser.parse(), argument_parser_error);
// long option
const char * argv2[] = {"./argument_parser_test", "--long"};
argument_parser parser2{"test_parser", 2, argv2, false};
parser2.add_option(option_value, 'i', "long", "this is an int option.");
- EXPECT_THROW(parser2.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser2.parse(), argument_parser_error);
// short option
const char * argv3[] = {"./argument_parser_test", "-i="};
argument_parser parser3{"test_parser", 2, argv3, false};
parser3.add_option(option_value, 'i', "long", "this is an int option.");
- EXPECT_THROW(parser3.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser3.parse(), argument_parser_error);
// short option
const char * argv4[] = {"./argument_parser_test", "--long="};
argument_parser parser4{"test_parser", 2, argv4, false};
parser4.add_option(option_value, 'i', "long", "this is an int option.");
- EXPECT_THROW(parser4.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser4.parse(), argument_parser_error);
}
TEST(parse_type_test, parse_success_bool_option)
@@ -503,14 +503,14 @@ TEST(parse_type_test, parse_error_bool_option)
argument_parser parser{"test_parser", 3, argv, false};
parser.add_option(option_value, 'b', "bool-option", "this is a bool option.");
- EXPECT_THROW(parser.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser.parse(), argument_parser_error);
// fail on number input expect 0 and 1
const char * argv2[] = {"./argument_parser_test", "-b", "124"};
argument_parser parser2{"test_parser", 3, argv2, false};
parser2.add_option(option_value, 'b', "bool-option", "this is a bool option.");
- EXPECT_THROW(parser2.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser2.parse(), argument_parser_error);
}
TEST(parse_type_test, parse_error_int_option)
@@ -522,21 +522,21 @@ TEST(parse_type_test, parse_error_int_option)
argument_parser parser{"test_parser", 3, argv, false};
parser.add_option(option_value, 'i', "int-option", "this is a int option.");
- EXPECT_THROW(parser.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser.parse(), argument_parser_error);
// fail on number followed by character
const char * argv2[] = {"./argument_parser_test", "-i", "2abc"};
argument_parser parser2{"test_parser", 3, argv2, false};
parser2.add_option(option_value, 'i', "int-option", "this is a int option.");
- EXPECT_THROW(parser2.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser2.parse(), argument_parser_error);
// fail on double
const char * argv3[] = {"./argument_parser_test", "-i", "3.12"};
argument_parser parser3{"test_parser", 3, argv3, false};
parser3.add_option(option_value, 'i', "int-option", "this is a int option.");
- EXPECT_THROW(parser3.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser3.parse(), argument_parser_error);
// fail on negative number for unsigned
unsigned option_value_u;
@@ -544,7 +544,7 @@ TEST(parse_type_test, parse_error_int_option)
argument_parser parser4{"test_parser", 3, argv4, false};
parser4.add_option(option_value_u, 'i', "int-option", "this is a int option.");
- EXPECT_THROW(parser4.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser4.parse(), argument_parser_error);
// fail on overflow
int8_t option_value_int8;
@@ -552,14 +552,14 @@ TEST(parse_type_test, parse_error_int_option)
argument_parser parser5{"test_parser", 3, argv5, false};
parser5.add_option(option_value_int8, 'i', "int-option", "this is a int option.");
- EXPECT_THROW(parser5.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser5.parse(), argument_parser_error);
uint8_t option_value_uint8;
const char * argv6[] = {"./argument_parser_test", "-i", "267"};
argument_parser parser6{"test_parser", 3, argv6, false};
parser6.add_option(option_value_uint8, 'i', "int-option", "this is a int option.");
- EXPECT_THROW(parser6.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser6.parse(), argument_parser_error);
}
TEST(parse_type_test, parse_error_double_option)
@@ -571,14 +571,14 @@ TEST(parse_type_test, parse_error_double_option)
argument_parser parser{"test_parser", 3, argv, false};
parser.add_option(option_value, 'd', "double-option", "this is a double option.");
- EXPECT_THROW(parser.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser.parse(), argument_parser_error);
// fail on number followed by character
const char * argv2[] = {"./argument_parser_test", "-d", "12.457a"};
argument_parser parser2{"test_parser", 3, argv2, false};
parser2.add_option(option_value, 'd', "double-option", "this is a double option.");
- EXPECT_THROW(parser2.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser2.parse(), argument_parser_error);
}
namespace foo
@@ -650,7 +650,7 @@ TEST(parse_type_test, parse_error_enum_option)
argument_parser parser{"test_parser", 3, argv, false};
parser.add_option(option_value, 'e', "enum-option", "this is an enum option.");
- EXPECT_THROW(parser.parse(), parser_invalid_argument);
+ EXPECT_THROW(parser.parse(), argument_parser_error);
}
TEST(parse_test, too_many_arguments_error)
@@ -867,12 +867,12 @@ TEST(parse_test, version_check_option_error)
{
{ // version-check must be followed by a value
const char * argv[] = {"./argument_parser_test", "--version-check"};
- EXPECT_THROW((argument_parser{"test_parser", 2, argv}), parser_invalid_argument);
+ EXPECT_THROW((argument_parser{"test_parser", 2, argv}), argument_parser_error);
}
{ // version-check value must be 0 or 1
const char * argv[] = {"./argument_parser_test", "--version-check", "foo"};
- EXPECT_THROW((argument_parser{"test_parser", 3, argv}), parser_invalid_argument);
+ EXPECT_THROW((argument_parser{"test_parser", 3, argv}), argument_parser_error);
}
}
@@ -934,6 +934,6 @@ TEST(parse_test, subcommand_argument_parser_success)
// incorrect sub command
{
const char * argv[]{"./top_level", "-f", "2", "subiddysub", "foo"};
- EXPECT_THROW((argument_parser{"top_level", 5, argv, false, {"sub1", "sub2"}}), parser_invalid_argument);
+ EXPECT_THROW((argument_parser{"top_level", 5, argv, false, {"sub1", "sub2"}}), argument_parser_error);
}
}
diff --git a/test/unit/argument_parser/format_parse_validators_test.cpp b/test/unit/argument_parser/format_parse_validators_test.cpp
index 9576b9c4c35..50cb5311bd2 100644
--- a/test/unit/argument_parser/format_parse_validators_test.cpp
+++ b/test/unit/argument_parser/format_parse_validators_test.cpp
@@ -91,19 +91,19 @@ TEST(validator_test, input_file)
std::filesystem::path does_not_exist{tmp_name.get_path()};
does_not_exist.replace_extension(".bam");
input_file_validator my_validator{formats};
- EXPECT_THROW(my_validator(does_not_exist), parser_invalid_argument);
+ EXPECT_THROW(my_validator(does_not_exist), validation_error);
}
{ // file has wrong format.
input_file_validator my_validator{std::vector{std::string{"sam"}}};
- EXPECT_THROW(my_validator(tmp_name.get_path()), parser_invalid_argument);
+ EXPECT_THROW(my_validator(tmp_name.get_path()), validation_error);
}
{ // file has no extension.
std::filesystem::path does_not_exist{tmp_name.get_path()};
does_not_exist.replace_extension();
input_file_validator my_validator{formats};
- EXPECT_THROW(my_validator(does_not_exist), parser_invalid_argument);
+ EXPECT_THROW(my_validator(does_not_exist), validation_error);
}
{ // read from file
@@ -188,19 +188,19 @@ TEST(validator_test, output_file)
std::ofstream tmp_file_2(tmp_name_2.get_path());
std::filesystem::path does_not_exist{tmp_name_2.get_path()};
output_file_validator my_validator{formats};
- EXPECT_THROW(my_validator(does_not_exist), parser_invalid_argument);
+ EXPECT_THROW(my_validator(does_not_exist), validation_error);
}
{ // file has wrong format.
output_file_validator my_validator{std::vector{std::string{"sam"}}};
- EXPECT_THROW(my_validator(tmp_name.get_path()), parser_invalid_argument);
+ EXPECT_THROW(my_validator(tmp_name.get_path()), validation_error);
}
{ // file has no extension.
std::filesystem::path no_extension{tmp_name.get_path()};
no_extension.replace_extension();
output_file_validator my_validator{formats};
- EXPECT_THROW(my_validator(no_extension), parser_invalid_argument);
+ EXPECT_THROW(my_validator(no_extension), validation_error);
}
{ // read from file
@@ -276,7 +276,7 @@ TEST(validator_test, input_directory)
{ // has filename
std::ofstream tmp_dir(tmp_name.get_path());
input_directory_validator my_validator{};
- EXPECT_THROW(my_validator(tmp_name.get_path()), parser_invalid_argument);
+ EXPECT_THROW(my_validator(tmp_name.get_path()), validation_error);
}
{ // read directory
@@ -416,7 +416,7 @@ TEST(validator_test, inputfile_not_readable)
if (!read_access(tmp_file))
{
- EXPECT_THROW(input_file_validator{}(tmp_file), parser_invalid_argument);
+ EXPECT_THROW(input_file_validator{}(tmp_file), validation_error);
}
std::filesystem::permissions(tmp_file,
@@ -441,7 +441,7 @@ TEST(validator_test, inputdir_not_readable)
if (!read_access(tmp_dir))
{
- EXPECT_THROW(input_directory_validator{}(tmp_dir), parser_invalid_argument);
+ EXPECT_THROW(input_directory_validator{}(tmp_dir), validation_error);
}
std::filesystem::permissions(tmp_dir,
@@ -465,7 +465,7 @@ TEST(validator_test, outputfile_not_writable)
if (!write_access(tmp_file))
{
- EXPECT_THROW(output_file_validator{}(tmp_file), parser_invalid_argument);
+ EXPECT_THROW(output_file_validator{}(tmp_file), validation_error);
}
// make sure we can remove the directory.
@@ -491,7 +491,7 @@ TEST(validator_test, outputdir_not_writable)
if (!write_access(tmp_dir))
{
- EXPECT_THROW(output_directory_validator{}(tmp_dir), parser_invalid_argument);
+ EXPECT_THROW(output_directory_validator{}(tmp_dir), validation_error);
}
// make sure we can remove the directory.
@@ -516,7 +516,7 @@ TEST(validator_test, outputdir_not_writable)
if (!write_access(tmp_dir))
{
- EXPECT_THROW(output_directory_validator{}(tmp_dir), parser_invalid_argument);
+ EXPECT_THROW(output_directory_validator{}(tmp_dir), validation_error);
}
// make sure we can remove the directory.
@@ -642,7 +642,7 @@ TEST(validator_test, arithmetic_range_validator_error)
parser.add_option(option_value, 'i', "int-option", "desc",
option_spec::DEFAULT, arithmetic_range_validator{1, 20});
- EXPECT_THROW(parser.parse(), validation_failed);
+ EXPECT_THROW(parser.parse(), validation_error);
// option - below min
const char * argv2[] = {"./argument_parser_test", "-i", "-21"};
@@ -650,21 +650,21 @@ TEST(validator_test, arithmetic_range_validator_error)
parser2.add_option(option_value, 'i', "int-option", "desc",
option_spec::DEFAULT, arithmetic_range_validator{-20, 20});
- EXPECT_THROW(parser2.parse(), validation_failed);
+ EXPECT_THROW(parser2.parse(), validation_error);
// positional option - above max
const char * argv3[] = {"./argument_parser_test", "30"};
argument_parser parser3{"test_parser", 2, argv3, false};
parser3.add_positional_option(option_value, "desc", arithmetic_range_validator{1, 20});
- EXPECT_THROW(parser3.parse(), validation_failed);
+ EXPECT_THROW(parser3.parse(), validation_error);
// positional option - below min
const char * argv4[] = {"./argument_parser_test", "--", "-21"};
argument_parser parser4{"test_parser", 3, argv4, false};
parser4.add_positional_option(option_value, "desc", arithmetic_range_validator{-20, 20});
- EXPECT_THROW(parser4.parse(), validation_failed);
+ EXPECT_THROW(parser4.parse(), validation_error);
// option - vector
const char * argv5[] = {"./argument_parser_test", "-i", "-100"};
@@ -672,7 +672,7 @@ TEST(validator_test, arithmetic_range_validator_error)
parser5.add_option(option_vector, 'i', "int-option", "desc",
option_spec::DEFAULT, arithmetic_range_validator{-50, 50});
- EXPECT_THROW(parser5.parse(), validation_failed);
+ EXPECT_THROW(parser5.parse(), validation_error);
// positional option - vector
option_vector.clear();
@@ -680,7 +680,7 @@ TEST(validator_test, arithmetic_range_validator_error)
argument_parser parser6{"test_parser", 4, argv6, false};
parser6.add_positional_option(option_vector, "desc", arithmetic_range_validator{-20, 20});
- EXPECT_THROW(parser6.parse(), validation_failed);
+ EXPECT_THROW(parser6.parse(), validation_error);
// option - double value
double double_option_value;
@@ -689,7 +689,7 @@ TEST(validator_test, arithmetic_range_validator_error)
parser7.add_option(double_option_value, 'i', "double-option", "desc",
option_spec::DEFAULT, arithmetic_range_validator{1, 20});
- EXPECT_THROW(parser7.parse(), validation_failed);
+ EXPECT_THROW(parser7.parse(), validation_error);
}
enum class foo
@@ -814,14 +814,14 @@ TEST(validator_test, value_list_validator_error)
parser.add_option(option_value, 's', "string-option", "desc",
option_spec::DEFAULT, value_list_validator{"ha", "ba", "ma"});
- EXPECT_THROW(parser.parse(), validation_failed);
+ EXPECT_THROW(parser.parse(), validation_error);
// positional option
const char * argv3[] = {"./argument_parser_test", "30"};
argument_parser parser3{"test_parser", 2, argv3, false};
parser3.add_positional_option(option_value_int, "desc", value_list_validator{0, 5, 10});
- EXPECT_THROW(parser3.parse(), validation_failed);
+ EXPECT_THROW(parser3.parse(), validation_error);
// positional option - vector
const char * argv4[] = {"./argument_parser_test", "fo", "ma"};
@@ -829,7 +829,7 @@ TEST(validator_test, value_list_validator_error)
parser4.add_positional_option(option_vector, "desc",
value_list_validator{"ha", "ba", "ma"});
- EXPECT_THROW(parser4.parse(), validation_failed);
+ EXPECT_THROW(parser4.parse(), validation_error);
// option - vector
const char * argv5[] = {"./argument_parser_test", "-i", "-10", "-i", "488"};
@@ -837,7 +837,7 @@ TEST(validator_test, value_list_validator_error)
parser5.add_option(option_vector_int, 'i', "int-option", "desc",
option_spec::DEFAULT, value_list_validator{-10, 48, 50});
- EXPECT_THROW(parser5.parse(), validation_failed);
+ EXPECT_THROW(parser5.parse(), validation_error);
}
TEST(validator_test, regex_validator_success)
@@ -927,7 +927,7 @@ TEST(validator_test, regex_validator_error)
parser.add_option(option_value, '\0', "string-option", "desc",
option_spec::DEFAULT, regex_validator{"tt"});
- EXPECT_THROW(parser.parse(), validation_failed);
+ EXPECT_THROW(parser.parse(), validation_error);
// positional option
const char * argv2[] = {"./argument_parser_test", "jessy"};
@@ -935,7 +935,7 @@ TEST(validator_test, regex_validator_error)
parser2.add_positional_option(option_value, "desc",
regex_validator{"[0-9]"});
- EXPECT_THROW(parser2.parse(), validation_failed);
+ EXPECT_THROW(parser2.parse(), validation_error);
// positional option - vector
const char * argv3[] = {"./argument_parser_test", "rollo", "bttllo", "lollo"};
@@ -943,7 +943,7 @@ TEST(validator_test, regex_validator_error)
parser3.add_positional_option(option_vector, "desc",
regex_validator{".*oll.*"});
- EXPECT_THROW(parser3.parse(), validation_failed);
+ EXPECT_THROW(parser3.parse(), validation_error);
// option - vector
option_vector.clear();
@@ -952,7 +952,7 @@ TEST(validator_test, regex_validator_error)
parser4.add_option(option_vector, 's', "", "desc",
option_spec::DEFAULT, regex_validator{"tt"});
- EXPECT_THROW(parser4.parse(), validation_failed);
+ EXPECT_THROW(parser4.parse(), validation_error);
}
TEST(validator_test, chaining_validators)
@@ -987,7 +987,7 @@ TEST(validator_test, chaining_validators)
parser.add_option(option_value, 's', "string-option", "desc",
option_spec::DEFAULT, absolute_path_validator | my_file_ext_validator);
- EXPECT_THROW(parser.parse(), validation_failed);
+ EXPECT_THROW(parser.parse(), validation_error);
}
{
@@ -997,7 +997,7 @@ TEST(validator_test, chaining_validators)
parser.add_option(option_value, 's', "string-option", "desc",
option_spec::DEFAULT, absolute_path_validator | my_file_ext_validator);
- EXPECT_THROW(parser.parse(), validation_failed);
+ EXPECT_THROW(parser.parse(), validation_error);
}
// with temporary validators