From: Francis Dupont Date: Sun, 27 Jan 2019 16:21:50 +0000 (+0100) Subject: [313-return-a-list-of-all-reservations-by-subnet-id] Removed spurious ';' and raise... X-Git-Tag: 429-Updated-StampedValue-to-support-reals_base~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a212c70c6f4815e2f256909f3ba2a7eff7061de7;p=thirdparty%2Fkea.git [313-return-a-list-of-all-reservations-by-subnet-id] Removed spurious ';' and raise OutOfRange --- diff --git a/src/lib/cc/simple_parser.cc b/src/lib/cc/simple_parser.cc index 781086da94..94fbbfcfeb 100644 --- a/src/lib/cc/simple_parser.cc +++ b/src/lib/cc/simple_parser.cc @@ -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); } diff --git a/src/lib/cc/simple_parser.h b/src/lib/cc/simple_parser.h index 2eef2cecfc..e1dc755776 100644 --- a/src/lib/cc/simple_parser.h +++ b/src/lib/cc/simple_parser.h @@ -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); diff --git a/src/lib/cc/tests/simple_parser_unittest.cc b/src/lib/cc/tests/simple_parser_unittest.cc index 6642a59dde..94905064cb 100644 --- a/src/lib/cc/tests/simple_parser_unittest.cc +++ b/src/lib/cc/tests/simple_parser_unittest.cc @@ -10,6 +10,7 @@ #include #include +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