aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/parsing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/utils/parsing.cpp')
-rw-r--r--src/lib/utils/parsing.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/utils/parsing.cpp b/src/lib/utils/parsing.cpp
index ff8d5f0fb..36b168290 100644
--- a/src/lib/utils/parsing.cpp
+++ b/src/lib/utils/parsing.cpp
@@ -10,12 +10,20 @@
#include <botan/charset.h>
#include <botan/get_byte.h>
#include <set>
+#include <stdexcept>
namespace Botan {
u32bit to_u32bit(const std::string& str)
{
- return std::stoul(str, nullptr);
+ try
+ {
+ return std::stoul(str, nullptr);
+ }
+ catch(std::exception&)
+ {
+ throw std::runtime_error("Could not read '" + str + "' as decimal string");
+ }
}
/*