From f20d1b1b72ec6b8fd4ee990d8d0ff22f9195d723 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Wed, 14 Nov 2018 15:52:36 +0400 Subject: [PATCH] Catch exception in the NIFTest --- apps/niftest/niftest.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/niftest/niftest.cpp b/apps/niftest/niftest.cpp index 572a58f26..6c0c74597 100644 --- a/apps/niftest/niftest.cpp +++ b/apps/niftest/niftest.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -128,14 +129,24 @@ std::vector parseOptions (int argc, char** argv) int main(int argc, char **argv) { - std::vector files = parseOptions (argc, argv); + std::vector files; + try + { + files = parseOptions (argc, argv); + } + catch( boost::exception &e ) + { + std::cout << "ERROR parsing arguments: " << boost::diagnostic_information(e) << std::endl; + exit(1); + } // std::cout << "Reading Files" << std::endl; for(std::vector::const_iterator it=files.begin(); it!=files.end(); ++it) { - std::string name = *it; + std::string name = *it; - try{ + try + { if(isNIF(name)) { //std::cout << "Decoding: " << name << std::endl;