From cccfa59b37d7b4dbe4e2429e495b2196e4244dc3 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Mon, 26 Mar 2018 20:52:57 +0200 Subject: [PATCH] improve out of range reporting --- pdns/misc.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pdns/misc.cc b/pdns/misc.cc index 8a6388816b..bd58036ce5 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -1367,8 +1367,11 @@ unsigned int pdns_stou(const std::string& str, size_t * idx, int base) catch(std::invalid_argument& e) { throw std::invalid_argument(string(e.what()) + "; (invalid argument during std::stoul); data was \""+str+"\""); } + catch(std::out_of_range& e) { + throw std::out_of_range(string(e.what()) + "; (out of range during std::stoul); data was \""+str+"\""); + } if (result > std::numeric_limits::max()) { - throw std::out_of_range("stou"); + throw std::out_of_range("stoul returned result out of unsigned int range; data was \""+str+"\""); } return static_cast(result); } -- 2.47.2