From: Peter van Dijk Date: Mon, 26 Mar 2018 18:52:57 +0000 (+0200) Subject: improve out of range reporting X-Git-Tag: dnsdist-1.3.0~21^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F6396%2Fhead;p=thirdparty%2Fpdns.git improve out of range reporting --- 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); }