add parse error exceptions for the command line args.
authorDiane Trout <diane@caltech.edu>
Sat, 4 Feb 2006 18:08:07 +0000 (18:08 +0000)
committerDiane Trout <diane@caltech.edu>
Sat, 4 Feb 2006 18:08:07 +0000 (18:08 +0000)
mussa.cxx

index 1ee7ae69dbfabd5ff13a943d7662ba88803a4e48..a946faeb68fb4620644d5ff10ddd9830f9c0a8b6 100644 (file)
--- a/mussa.cxx
+++ b/mussa.cxx
@@ -82,6 +82,11 @@ int main(int argc, char **argv)
   }
 }
 
+struct ParseError
+{
+  string err;
+  ParseError(const string& msg) : err(msg) { } ;
+};
 
 // minimal arg reading function, not very robust to errors
 char
@@ -130,7 +135,7 @@ parse_args(int argc, char **argv, string *a_file_path, int *window,
        {
          cout << "Error: \'" << an_arg;
          cout << "\' is not a valid analysis mode for -a argument" << endl; 
-         run_mode = 'e';
+          throw ParseError("not valid -a argument");
        }
        *a_file_path = * ++argv;
        i++;
@@ -147,7 +152,7 @@ parse_args(int argc, char **argv, string *a_file_path, int *window,
        {
          cout << "Error: \'" << an_arg;
          cout << "\' is not a valid run mode for -m argument" << endl; 
-         run_mode = 'e';
+         throw ParseError("bad argument -m");
        }
 
       }