Made parser exception message more meaningful.

This commit is contained in:
Patrick Lühne 2016-06-09 15:18:36 +02:00
parent 87889f5efe
commit 2245422d0f
2 changed files with 6 additions and 0 deletions

View File

@ -54,7 +54,10 @@ void Domain::findSections()
[&](const std::string &sectionName, auto &sectionPosition, const auto value, bool unique = false) [&](const std::string &sectionName, auto &sectionPosition, const auto value, bool unique = false)
{ {
if (unique && sectionPosition != -1) if (unique && sectionPosition != -1)
{
parser.seek(value);
throw utils::ParserException(parser, "Only one \":" + sectionName + "\" section allowed"); throw utils::ParserException(parser, "Only one \":" + sectionName + "\" section allowed");
}
sectionPosition = value; sectionPosition = value;
}; };

View File

@ -51,7 +51,10 @@ void Problem::findSections()
[&](const std::string &sectionName, auto &sectionPosition, const auto value, bool unique = false) [&](const std::string &sectionName, auto &sectionPosition, const auto value, bool unique = false)
{ {
if (unique && sectionPosition != -1) if (unique && sectionPosition != -1)
{
parser.seek(value);
throw utils::ParserException(parser, "Only one \":" + sectionName + "\" section allowed"); throw utils::ParserException(parser, "Only one \":" + sectionName + "\" section allowed");
}
sectionPosition = value; sectionPosition = value;
}; };