} 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() << "\"");
}
}
/// @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);
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"
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
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) { };
};