diff options
Diffstat (limited to '')
-rw-r--r-- | utils/data_parsers.hpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/utils/data_parsers.hpp b/utils/data_parsers.hpp index 08486fa..433ade3 100644 --- a/utils/data_parsers.hpp +++ b/utils/data_parsers.hpp @@ -18,6 +18,8 @@ static std::istream& operator>>(std::istream& is, aesni::Mode& dest) { + static const char* const argument_name = "mode"; + std::string src; is >> src; @@ -32,13 +34,19 @@ static std::istream& operator>>(std::istream& is, aesni::Mode& dest) else if (boost::iequals(src, "ctr")) dest = AESNI_CTR; else - throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value, "mode", src); + { + throw boost::program_options::validation_error( + boost::program_options::validation_error::invalid_option_value, + argument_name, src); + } return is; } static std::istream& operator>>(std::istream& is, aesni::Algorithm& dest) { + static const char* const argument_name = "algorithm"; + std::string src; is >> src; @@ -49,7 +57,11 @@ static std::istream& operator>>(std::istream& is, aesni::Algorithm& dest) else if (boost::iequals(src, "aes256")) dest = AESNI_AES256; else - throw boost::program_options::validation_error(boost::program_options::validation_error::invalid_option_value, "algorithm", src); + { + throw boost::program_options::validation_error( + boost::program_options::validation_error::invalid_option_value, + argument_name, src); + } return is; } |