summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2015-11-13 23:21:13 +0100
committerFrancis Dupont <fdupont@isc.org>2015-11-13 23:21:13 +0100
commit8197502648aba23699397d70e08beea9b9fe9bcd (patch)
tree5e34dd9dcfebd81c49281b909aa1a190a9c566e5 /src
parent[4094] Addressed comments (comments, complex test) (diff)
downloadkea-8197502648aba23699397d70e08beea9b9fe9bcd.tar.xz
kea-8197502648aba23699397d70e08beea9b9fe9bcd.zip
[4094] Changed EvalNotBoolError to shared EvalTypeError
Diffstat (limited to 'src')
-rw-r--r--src/lib/eval/evaluate.cc2
-rw-r--r--src/lib/eval/evaluate.h2
-rw-r--r--src/lib/eval/tests/evaluate_unittest.cc4
-rw-r--r--src/lib/eval/token.h8
4 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/eval/evaluate.cc b/src/lib/eval/evaluate.cc
index 593a8c9541..a70ee2c6ed 100644
--- a/src/lib/eval/evaluate.cc
+++ b/src/lib/eval/evaluate.cc
@@ -32,7 +32,7 @@ bool evaluate(const Expression& expr, const Pkt& pkt) {
} else if (values.top() == "true") {
return (true);
} else {
- isc_throw(EvalNotBoolError, "Incorrect evaluation type. Expected "
+ isc_throw(EvalTypeError, "Incorrect evaluation type. Expected "
"\"false\" or \"true\", got \"" << values.top() << "\"");
}
}
diff --git a/src/lib/eval/evaluate.h b/src/lib/eval/evaluate.h
index f1c57248fd..1e7ee005ae 100644
--- a/src/lib/eval/evaluate.h
+++ b/src/lib/eval/evaluate.h
@@ -28,7 +28,7 @@ namespace dhcp {
/// @return the boolean decision
/// @throw EvalStackError if there is not exactly one element on the value
/// stack at the end of the evaluation
-/// @throw EvalNotBoolError if the value at the top of the stack at the
+/// @throw EvalTypeError if the value at the top of the stack at the
/// end of the evaluation is not "false" or "true"
bool evaluate(const Expression& expr, const Pkt& pkt);
diff --git a/src/lib/eval/tests/evaluate_unittest.cc b/src/lib/eval/tests/evaluate_unittest.cc
index bccdba7d47..5cb090be1a 100644
--- a/src/lib/eval/tests/evaluate_unittest.cc
+++ b/src/lib/eval/tests/evaluate_unittest.cc
@@ -124,7 +124,7 @@ TEST_F(EvaluateTest, bad4) {
TokenPtr bad;
ASSERT_NO_THROW(bad.reset(new TokenString("bad")));
e_.push_back(bad);
- ASSERT_THROW(evaluate(e_, *pkt4_), EvalNotBoolError);
+ ASSERT_THROW(evaluate(e_, *pkt4_), EvalTypeError);
}
// This checks the evaluation must lead to "false" or "true"
@@ -133,7 +133,7 @@ TEST_F(EvaluateTest, bad6) {
TokenPtr bad;
ASSERT_NO_THROW(bad.reset(new TokenString("bad")));
e_.push_back(bad);
- ASSERT_THROW(evaluate(e_, *pkt6_), EvalNotBoolError);
+ ASSERT_THROW(evaluate(e_, *pkt6_), EvalTypeError);
}
// This checks the evaluation must leave only one value on the stack
diff --git a/src/lib/eval/token.h b/src/lib/eval/token.h
index 561d9db84c..27ec7430c6 100644
--- a/src/lib/eval/token.h
+++ b/src/lib/eval/token.h
@@ -46,11 +46,11 @@ public:
isc::Exception(file, line, what) { };
};
-/// @brief EvalNotBoolError is thrown when a boolean (i.e., "false" or
-/// "true") was required but is not.
-class EvalNotBoolError : public Exception {
+/// @brief EvalTypeError is thrown when a value on the stack has a content
+/// with an unexpected type.
+class EvalTypeError : public Exception {
public:
- EvalNotBoolError(const char* file, size_t line, const char* what) :
+ EvalTypeError(const char* file, size_t line, const char* what) :
isc::Exception(file, line, what) { };
};