From 58fca986c9f7710bf4f6ef1d16eeb52da5474f53 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 (cherry picked from commit cccfa59b37d7b4dbe4e2429e495b2196e4244dc3) --- pdns/misc.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pdns/misc.cc b/pdns/misc.cc index 16b3908f5..3e2ea6117 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -1313,8 +1313,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.40.0