From: Wolfgang Bangerth Date: Sat, 13 Dec 2014 04:18:12 +0000 (-0600) Subject: Make an error message easier to read. X-Git-Tag: v8.2.0-rc1~15^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F301%2Fhead;p=dealii.git Make an error message easier to read. Enclose strings in <...> so that one can more easily see if there happen to be spaces in untoward places. --- diff --git a/source/base/function_parser.cc b/source/base/function_parser.cc index 2faa6ea9fa..1182bd31d9 100644 --- a/source/base/function_parser.cc +++ b/source/base/function_parser.cc @@ -254,11 +254,11 @@ void FunctionParser:: 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::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::value (const Point &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; }