From 6d7954e661ae94f2f7034d0221c5f43f4b804a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Fri, 20 May 2016 16:20:51 +0200 Subject: [PATCH] Better handling of number parsing exceptions. --- src/plasp/sas/Description.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plasp/sas/Description.cpp b/src/plasp/sas/Description.cpp index bf24cfc..df5b774 100644 --- a/src/plasp/sas/Description.cpp +++ b/src/plasp/sas/Description.cpp @@ -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::max(); - istream >> number; + + try + { + istream >> number; + } + catch (const std::exception &e) + { + throw ParserException("Could not parse number"); + } if (number == std::numeric_limits::max()) throw ParserException("Invalid number");