patrick
/
plasp
Archived
1
0
Fork 0

Better handling of number parsing exceptions.

This commit is contained in:
Patrick Lühne 2016-05-20 16:20:51 +02:00
parent d7984e9b3a
commit 6d7954e661
1 changed files with 9 additions and 1 deletions

View File

@ -182,7 +182,15 @@ void Description::parseSectionIdentifier(std::istream &istream, const std::strin
size_t Description::parseNumber(std::istream &istream) const
{
auto number = std::numeric_limits<size_t>::max();
istream >> number;
try
{
istream >> number;
}
catch (const std::exception &e)
{
throw ParserException("Could not parse number");
}
if (number == std::numeric_limits<size_t>::max())
throw ParserException("Invalid number");