summaryrefslogtreecommitdiffstats
path: root/src/lib/cc
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2019-01-27 17:21:50 +0100
committerFrancis Dupont <fdupont@isc.org>2019-01-29 10:49:05 +0100
commita212c70c6f4815e2f256909f3ba2a7eff7061de7 (patch)
treed899fce9222879b21c7d1e80d870052917c64c4a /src/lib/cc
parent[313-return-a-list-of-all-reservations-by-subnet-id] Commented NotImplemented... (diff)
downloadkea-a212c70c6f4815e2f256909f3ba2a7eff7061de7.tar.xz
kea-a212c70c6f4815e2f256909f3ba2a7eff7061de7.zip
[313-return-a-list-of-all-reservations-by-subnet-id] Removed spurious ';' and raise OutOfRange
Diffstat (limited to 'src/lib/cc')
-rw-r--r--src/lib/cc/simple_parser.cc4
-rw-r--r--src/lib/cc/simple_parser.h3
-rw-r--r--src/lib/cc/tests/simple_parser_unittest.cc5
3 files changed, 7 insertions, 5 deletions
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 <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