diff --git a/src/App/Expression.cpp b/src/App/Expression.cpp index d87d381dae..1afb5ec56e 100644 --- a/src/App/Expression.cpp +++ b/src/App/Expression.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -3786,14 +3787,17 @@ Expression * App::ExpressionParser::parse(const App::DocumentObject *owner, cons // run the parser int result = ExpressionParser::ExpressionParser_yyparse (); - if (result != 0) - throw ParserError("Failed to parse expression."); + if (result != 0) { + throw ParserError(fmt::format("Failed to parse expression '{}'", buffer)); + } - if (!ScanResult) - throw ParserError("Unknown error in expression"); + if (!ScanResult) { + throw ParserError(fmt::format("Unknown error in expression '{}'", buffer)); + } - if (valueExpression) + if (valueExpression) { return ScanResult; + } else { delete ScanResult; throw Expression::Exception("Expression can not evaluate to a value.");