From f3a880b0a6e1fa3aa4c215e4d3d78fe722a28522 Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Tue, 24 Jan 2017 16:30:25 +0100 Subject: [PATCH] [5019] SimpleParser methods are now public (used in global parsers) --- src/lib/cc/simple_parser.cc | 19 +++++++++++++------ src/lib/cc/simple_parser.h | 2 -- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/lib/cc/simple_parser.cc b/src/lib/cc/simple_parser.cc index 21444b75e7..ac77a59656 100644 --- a/src/lib/cc/simple_parser.cc +++ b/src/lib/cc/simple_parser.cc @@ -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()); diff --git a/src/lib/cc/simple_parser.h b/src/lib/cc/simple_parser.h index 3747ea5da8..bba7620ae1 100644 --- a/src/lib/cc/simple_parser.h +++ b/src/lib/cc/simple_parser.h @@ -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 -- 2.47.2