]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4094] Changed EvalNotBoolError to shared EvalTypeError
authorFrancis Dupont <fdupont@isc.org>
Fri, 13 Nov 2015 22:21:13 +0000 (23:21 +0100)
committerFrancis Dupont <fdupont@isc.org>
Fri, 13 Nov 2015 22:21:13 +0000 (23:21 +0100)
src/lib/eval/evaluate.cc
src/lib/eval/evaluate.h
src/lib/eval/tests/evaluate_unittest.cc
src/lib/eval/token.h

index 593a8c954173df06444d1ba639831a5d4fab9fa9..a70ee2c6ed53805decf9cd25a238ccbff12b26da 100644 (file)
@@ -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() << "\"");
     }
 }
index f1c57248fdcdb4f4b4e432ec18f1fccbf3e7b8d5..1e7ee005aeaa62e5001231eade70a23e683da7d2 100644 (file)
@@ -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);
 
index bccdba7d47eeb55c77112a23afc4e1b743bcf6c5..5cb090be1a7eabae8b0a735d9ed702fe4dfabacc 100644 (file)
@@ -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
index 561d9db84caf0a8dbc2b69b6d347353ad7bec538..27ec7430c678027e53a1ff5d0e48e05a8a2e6e57 100644 (file)
@@ -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) { };
 };