From 2c0ac8dd61597571e24c08b3503f80145e6eb45f Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 12 Dec 2014 22:18:12 -0600 Subject: [PATCH] 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. --- source/base/function_parser.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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; } -- 2.39.5