diff --git a/src/main.cpp b/src/main.cpp index 62ad6fa..a7c386d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,13 +17,19 @@ #include "options.hpp" #include +#include +#include #include +#include #include #include int main(int argc, char *argv[]) { + namespace po = boost::program_options; + + using std::cerr; using std::cout; boost::locale::generator locale_generator; @@ -33,7 +39,16 @@ int main(int argc, char *argv[]) std::locale::global(locale_generator("")); cout.imbue(std::locale()); - auto vm{epubgrep::parse_options(argc, argv)}; + po::variables_map vm; + try + { + vm = epubgrep::parse_options(argc, argv); + } + catch (std::exception &e) + { // Exceptions we can't recover from or ones we don't know. + cerr << "ERROR: " << e.what() << '\n'; + return EXIT_FAILURE; + } if (vm.count("help") + vm.count("version") > 0) {