]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5019] SimpleParser methods are now public (used in global parsers)
authorTomek Mrugalski <tomasz@isc.org>
Tue, 24 Jan 2017 15:30:25 +0000 (16:30 +0100)
committerTomek Mrugalski <tomasz@isc.org>
Thu, 26 Jan 2017 12:43:22 +0000 (13:43 +0100)
src/lib/cc/simple_parser.cc
src/lib/cc/simple_parser.h

index 21444b75e7db832dc1aaf99bd258a87c1b8918d9..ac77a5965694af23d29c70173d27ee363946c57e 100644 (file)
@@ -19,10 +19,12 @@ std::string
 SimpleParser::getString(isc::data::ConstElementPtr scope, const std::string& name) {
     ConstElementPtr x = scope->get(name);
     if (!x) {
-        isc_throw(BadValue, "Element " << name << " not found");
+        isc_throw(BadValue, "String parameter " << name << " not found"
+                  << "(" << scope->getPosition() << ")");
     }
     if (x->getType() != Element::string) {
-        isc_throw(BadValue, "Element " << name << " found, but is not a string");
+        isc_throw(BadValue, "Element " << name << " found, but is not a string"
+                  << "(" << x->getPosition() << ")");
     }
 
     return (x->stringValue());
@@ -32,10 +34,12 @@ int64_t
 SimpleParser::getInteger(isc::data::ConstElementPtr scope, const std::string& name) {
     ConstElementPtr x = scope->get(name);
     if (!x) {
-        isc_throw(BadValue, "Element " << name << " not found");
+        isc_throw(BadValue, "Integer parameter " << name << " not found "
+                  << "(" << scope->getPosition() << ")");
     }
     if (x->getType() != Element::integer) {
-        isc_throw(BadValue, "Element " << name << " found, but is not an integer");
+        isc_throw(BadValue, "Element " << name << " found, but is not an integer"
+                  << "(" << x->getPosition() << ")");
     }
 
     return (x->intValue());
@@ -45,10 +49,13 @@ bool
 SimpleParser::getBoolean(isc::data::ConstElementPtr scope, const std::string& name) {
     ConstElementPtr x = scope->get(name);
     if (!x) {
-        isc_throw(BadValue, "Element " << name << " not found");
+        isc_throw(BadValue, "Boolean element " << name << " not found "
+                  << "(" << scope->getPosition() << ")");
+
     }
     if (x->getType() != Element::boolean) {
-        isc_throw(BadValue, "Element " << name << " found, but is not a boolean");
+        isc_throw(BadValue, "Element " << name << " found, but is not a boolean"
+                  << "(" << x->getPosition() << ")");
     }
 
     return (x->boolValue());
index 3747ea5da841c4aa9de4c62d36092785320557ec..bba7620ae145858ed2ec3cc3ffa42d5e8cef5feb 100644 (file)
@@ -113,8 +113,6 @@ class SimpleParser {
     static const data::Element::Position&
     getPosition(const std::string& name, const data::ConstElementPtr parent);
 
- protected:
-
     /// @brief Returns a string parameter from a scope
     ///
     /// Unconditionally returns a parameter. If the parameter is not there or