this is not a program error, so CacheConfigError should be more appropriate.
const dns::Name zone_name(zones->get(i)->stringValue());
if (!zone_config_.insert(Zones::value_type(zone_name,
"")).second) {
- isc_throw(InvalidParameter, "Duplicate cache zone: " <<
+ isc_throw(CacheConfigError, "Duplicate cache zone: " <<
zone_name);
}
}
/// - Each string value of cache-zones entries must be a valid textual
/// representation of a domain name. Otherwise corresponding
/// exception from the dns::Name class will be thrown.
+ /// - Names in the list must not have duplicates;
+ /// throws CacheConfigError otherwise.
///
/// For other data source types than "MasterFiles", cache can be disabled.
/// In this case cache-zones configuration item is simply ignored, even
/// item if defined; otherwise it defaults to "local".
///
/// \throw InvalidParameter Program error at the caller side rather than
- /// in the configuration.
+ /// in the configuration (see above)
/// \throw CacheConfigError There is a semantics error in the given
- /// configuration.
+ /// configuration (see above)
/// \throw data::TypeError There is a syntax error in the given
- /// configuration.
+ /// configuration (see above)
///
/// \param datasrc_type Type of data source. This must be the "type"
/// value of the data source configuration.
EXPECT_THROW(CacheConfig("mock", &mock_client_, *bad_config, true),
isc::dns::EmptyLabel);
- // duplicate zone name
+ // duplicate zone name (note that comparison is case insensitive)
const ConstElementPtr dup_config(Element::fromJSON(
"{\"cache-enable\": true,"
" \"cache-zones\": "
- " [\"example\", \"example\"]}"));
+ " [\"example\", \"EXAMPLE\"]}"));
EXPECT_THROW(CacheConfig("mock", &mock_client_, *dup_config, true),
- isc::InvalidParameter);
+ CacheConfigError);
// datasrc is null
EXPECT_THROW(CacheConfig("mock", 0, *mock_config_, true),