diff --git a/algo/base/Options.cxx b/algo/base/Options.cxx index 4ac19dc7809a2c1d395ec0a7dfe5552797a7120a..36e2c1eda83a62573012af40f13072e902f9c7c9 100644 --- a/algo/base/Options.cxx +++ b/algo/base/Options.cxx @@ -73,11 +73,19 @@ Options::Options(int argc, char** argv) po::variables_map vm; po::command_line_parser parser {argc, argv}; parser.options(cmdline_options); - po::store(parser.run(), vm); + try { + auto result = parser.run(); + po::store(result, vm); + } + catch (const boost::wrapexcept<po::unknown_option>& e) { + std::cerr << "Error: " << e.what() << std::endl; + std::cerr << cmdline_options << std::endl; + std::exit(EXIT_FAILURE); + } if (vm.count("help")) { std::cerr << cmdline_options << std::endl; - std::exit(0); + std::exit(EXIT_SUCCESS); } try { @@ -86,6 +94,6 @@ Options::Options(int argc, char** argv) catch (const po::required_option& e) { std::cerr << "Error: " << e.what() << std::endl; std::cerr << cmdline_options << std::endl; - std::exit(1); + std::exit(EXIT_FAILURE); } }