Handling further parser exceptions.
This commit is contained in:
parent
c61bdfd9f1
commit
48bd3c77ad
@ -289,6 +289,8 @@ void Description::parseVariablesSection(std::istream &istream)
|
|||||||
const auto numberOfValues = parse<size_t>(istream);
|
const auto numberOfValues = parse<size_t>(istream);
|
||||||
variable.values.resize(numberOfValues);
|
variable.values.resize(numberOfValues);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
istream.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
istream.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||||
|
|
||||||
for (size_t j = 0; j < numberOfValues; j++)
|
for (size_t j = 0; j < numberOfValues; j++)
|
||||||
@ -296,6 +298,11 @@ void Description::parseVariablesSection(std::istream &istream)
|
|||||||
auto &value = variable.values[j];
|
auto &value = variable.values[j];
|
||||||
std::getline(istream, value.name);
|
std::getline(istream, value.name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (const std::exception &e)
|
||||||
|
{
|
||||||
|
throw ParserException("Could not parse variable " + variable.name + " (" + e.what() + ")");
|
||||||
|
}
|
||||||
|
|
||||||
parseSectionIdentifier(istream, "end_variable");
|
parseSectionIdentifier(istream, "end_variable");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user