]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make an error message easier to read. 301/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 13 Dec 2014 04:18:12 +0000 (22:18 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 14 Dec 2014 12:55:10 +0000 (06:55 -0600)
Enclose strings in <...> so that one can more easily see if there happen
to be spaces in untoward places.

source/base/function_parser.cc

index 2faa6ea9fabd33fd549379a980b9c8fcec5eceed..1182bd31d9da58f76c88eb86b616b81c40d44bb2 100644 (file)
@@ -254,11 +254,11 @@ void FunctionParser<dim>:: init_muparser() const
         }
       catch (mu::ParserError &e)
         {
-          std::cerr << "Message:  " << e.GetMsg() << "\n";
-          std::cerr << "Formula:  " << e.GetExpr() << "\n";
-          std::cerr << "Token:    " << e.GetToken() << "\n";
-          std::cerr << "Position: " << e.GetPos() << "\n";
-          std::cerr << "Errc:     " << e.GetCode() << std::endl;
+          std::cerr << "Message:  <" << e.GetMsg() << ">\n";
+          std::cerr << "Formula:  <" << e.GetExpr() << ">\n";
+          std::cerr << "Token:    <" << e.GetToken() << ">\n";
+          std::cerr << "Position: <" << e.GetPos() << ">\n";
+          std::cerr << "Errc:     <" << e.GetCode() << ">" << std::endl;
           AssertThrow(false, ExcParseError(e.GetCode(), e.GetMsg().c_str()));
         }
     }
@@ -279,7 +279,7 @@ void FunctionParser<dim>::initialize (const std::string   &variables,
   this->var_names = Utilities::split_string_list(variables, ',');
   this->expressions = expressions;
   AssertThrow(((time_dependent)?dim+1:dim) == var_names.size(),
-              ExcMessage("wrong number of variables"));
+              ExcMessage("Wrong number of variables"));
   AssertThrow(!use_degrees, ExcNotImplemented());
 
   // We check that the number of
@@ -397,11 +397,11 @@ double FunctionParser<dim>::value (const Point<dim>  &p,
     }
   catch (mu::ParserError &e)
     {
-      std::cerr << "Message:  " << e.GetMsg() << "\n";
-      std::cerr << "Formula:  " << e.GetExpr() << "\n";
-      std::cerr << "Token:    " << e.GetToken() << "\n";
-      std::cerr << "Position: " << e.GetPos() << "\n";
-      std::cerr << "Errc:     " << e.GetCode() << std::endl;
+      std::cerr << "Message:  <" << e.GetMsg() << ">\n";
+      std::cerr << "Formula:  <" << e.GetExpr() << ">\n";
+      std::cerr << "Token:    <" << e.GetToken() << ">\n";
+      std::cerr << "Position: <" << e.GetPos() << ">\n";
+      std::cerr << "Errc:     <" << e.GetCode() << ">" << std::endl;
       AssertThrow(false, ExcParseError(e.GetCode(), e.GetMsg().c_str()));
       return 0.0;
     }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.