Handling further parser exceptions.

This commit is contained in:
Patrick Lühne 2016-05-20 17:01:48 +02:00
parent c61bdfd9f1
commit 48bd3c77ad

View File

@ -289,6 +289,8 @@ void Description::parseVariablesSection(std::istream &istream)
const auto numberOfValues = parse<size_t>(istream);
variable.values.resize(numberOfValues);
try
{
istream.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
for (size_t j = 0; j < numberOfValues; j++)
@ -296,6 +298,11 @@ void Description::parseVariablesSection(std::istream &istream)
auto &value = variable.values[j];
std::getline(istream, value.name);
}
}
catch (const std::exception &e)
{
throw ParserException("Could not parse variable " + variable.name + " (" + e.what() + ")");
}
parseSectionIdentifier(istream, "end_variable");
}