TranslatorDatabase::getDatabaseKea(const string& xpath) {
ConstElementPtr type = getItem(xpath + "/database-type");
if (!type) {
- return (ElementPtr());
+ // Can't happen as database-type is the key.
+ isc_throw(Unexpected, "getDatabaseKea requires database-type: "
+ << xpath);
}
ElementPtr result = Element::createMap();
result->set("type", type);
if (!skip) {
ConstElementPtr type = elem->get("type");
if (!type) {
- isc_throw(BadValue, "setDatabase missing database type");
+ isc_throw(BadValue, "setDatabase requires database type: "
+ << elem->str());
}
setItem(xpath + "/database-type", type, SR_STRING_T);
}
TranslatorDatabases::getDatabasesKea(const string& xpath) {
S_Iter_Value iter = getIter(xpath + "/*");
if (!iter) {
- return (ElementPtr());
+ // Can't happen.
+ isc_throw(Unexpected, "getDatabasesKea can't get iterator: " << xpath);
}
ElementPtr result = Element::createList();
for (;;) {
/// @param xpath The xpath of the database access.
/// @param elem The JSON element.
/// @param skip The skip type field flag.
+ /// @throw BadValue on database without tyoe,
void setDatabaseKea(const std::string& xpath,
isc::data::ConstElementPtr elem,
bool skip);
///
/// @param xpath The xpath of databases.
/// @param elem The JSON element.
+ /// @throw BadValue on database without tyoe,
void setDatabasesKea(const std::string& xpath,
isc::data::ConstElementPtr elem);