Merge pull request #1933 from joakim-hove/throw-same

Rethrow the same exception
This commit is contained in:
Joakim Hove 2020-09-18 15:28:05 +02:00 committed by GitHub
commit ac40c65f64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -928,11 +928,9 @@ bool parseState( ParserState& parserState, const Parser& parser ) {
we should not be tempted to continue the parsing. we should not be tempted to continue the parsing.
*/ */
const auto& location = rawKeyword->location(); const auto& location = rawKeyword->location();
std::string msg = "\nFailed to parse keyword: " + rawKeyword->getKeywordName() + "\n" + std::string msg = Log::fileMessage(location, "Parse error: " + std::string{ exc.what() });
"In file " + location.filename + ", line " + std::to_string(location.lineno) + "\n\n" + OpmLog::error(msg);
"Error message: " + exc.what() + "\n"; throw;
throw std::invalid_argument(msg);
} }
} else { } else {
const std::string msg = "The keyword " + rawKeyword->getKeywordName() + " is not recognized - ignored"; const std::string msg = "The keyword " + rawKeyword->getKeywordName() + " is not recognized - ignored";