]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
improve out of range reporting 6396/head
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 26 Mar 2018 18:52:57 +0000 (20:52 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Mon, 26 Mar 2018 18:52:57 +0000 (20:52 +0200)
pdns/misc.cc

index 8a6388816b84b13016309116cf519b088a29a6f2..bd58036ce51eff538e5434edbf840ad4b90d201f 100644 (file)
@@ -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<unsigned int>::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<unsigned int>(result);
 }