Browse Source

bug #1627: Generate better error messages when origin is not specified

Mukund Sivaraman 13 years ago
parent
commit
06280cc6b4
1 changed files with 10 additions and 3 deletions
  1. 10 3
      src/bin/auth/auth_config.cc

+ 10 - 3
src/bin/auth/auth_config.cc

@@ -163,9 +163,16 @@ MemoryDatasourceConfig::build(ConstElementPtr config_value) {
             isc_throw(AuthConfigError, "Missing zone file for zone: "
             isc_throw(AuthConfigError, "Missing zone file for zone: "
                       << origin->str());
                       << origin->str());
         }
         }
-        boost::shared_ptr<InMemoryZoneFinder> zone_finder(new
+
-                                                   InMemoryZoneFinder(rrclass_,
+	InMemoryZoneFinder *imzf = NULL;
-            Name(origin->stringValue())));
+	try {
+	    imzf = new InMemoryZoneFinder(rrclass_, Name(origin->stringValue()));
+	} catch (const isc::dns::NameParserException& ex) {
+	    isc_throw(AuthConfigError, "Error parsing zone's origin: " <<
+		      ex.what());
+	}
+
+	boost::shared_ptr<InMemoryZoneFinder> zone_finder(imzf);
         const result::Result result = memory_client_->addZone(zone_finder);
         const result::Result result = memory_client_->addZone(zone_finder);
         if (result == result::EXIST) {
         if (result == result::EXIST) {
             isc_throw(AuthConfigError, "zone "<< origin->str()
             isc_throw(AuthConfigError, "zone "<< origin->str()