]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[313-return-a-list-of-all-reservations-by-subnet-id] Removed spurious ';' and raise...
authorFrancis Dupont <fdupont@isc.org>
Sun, 27 Jan 2019 16:21:50 +0000 (17:21 +0100)
committerFrancis Dupont <fdupont@isc.org>
Tue, 29 Jan 2019 09:49:05 +0000 (04:49 -0500)
src/lib/cc/simple_parser.cc
src/lib/cc/simple_parser.h
src/lib/cc/tests/simple_parser_unittest.cc

index 781086da94da0cc04fff7e431b33e62de8a2d476..94fbbfcfeb8622e0a0eb387efc9036ca8425497c 100644 (file)
@@ -94,10 +94,10 @@ SimpleParser::getInteger(isc::data::ConstElementPtr scope, const std::string& na
                          int64_t min, int64_t max) {
     int64_t tmp = getInteger(scope, name);
     if (tmp < min || tmp > max) {
-        isc_throw(DhcpConfigError,
+        isc_throw(OutOfRange,
                   "The '" << name << "' value (" << tmp
                   << ") is not within expected range: (" << min << " - " << max
-                  << ");");
+                  << ")");
     }
     return (tmp);
 }
index 2eef2cecfc4707ba24eff83bbe54ab5430747ac2..e1dc755776a48edd769b2b22956b6022db9dad2f 100644 (file)
@@ -181,7 +181,8 @@ class SimpleParser {
     /// @param max maximum allowed value
     /// @return an integer value of the parameter
     /// @throw DhcpConfigError if the parameter is not there or is not of
-    /// appropriate type or is out of range
+    /// appropriate type.
+    /// @throw OutOfRange if the parameter is out of range
     static int64_t getInteger(isc::data::ConstElementPtr scope,
                               const std::string& name,
                               int64_t min, int64_t max);
index 6642a59ddee14f59db0d6ff12ef59c7644ac54ce..94905064cbf4c4ef13fd2aa3cfd94fe84570f0e5 100644 (file)
@@ -10,6 +10,7 @@
 #include <cc/simple_parser.h>
 #include <gtest/gtest.h>
 
+using namespace isc;
 using namespace isc::data;
 using namespace isc::asiolink;
 using isc::dhcp::DhcpConfigError;
@@ -259,8 +260,8 @@ TEST_F(SimpleParserTest, getInteger) {
     EXPECT_NO_THROW(x = SimpleParser::getInteger(json, "bar", 1, 100));
 
     // Out of expected range. Should throw.
-    EXPECT_THROW(x = SimpleParser::getInteger(json, "bar", 101, 200), DhcpConfigError);
-    EXPECT_THROW(x = SimpleParser::getInteger(json, "bar", 1, 99), DhcpConfigError);
+    EXPECT_THROW(x = SimpleParser::getInteger(json, "bar", 101, 200), OutOfRange);
+    EXPECT_THROW(x = SimpleParser::getInteger(json, "bar", 1, 99), OutOfRange);
 }
 
 // This test exercises the getAndConvert template