]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Better error message for unfound new slave domains 3051/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 16 Dec 2015 16:18:10 +0000 (17:18 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Mon, 4 Jul 2016 15:03:12 +0000 (17:03 +0200)
Closes #2405

modules/bindbackend/bindbackend2.cc
pdns/zoneparser-tng.cc

index d961d150a79b4eb63a72c5025df9721a0ff81e92..7a021743eac47ae8be4ebda508fc273a34737878 100644 (file)
@@ -33,6 +33,7 @@
 #include <fcntl.h>
 #include <sstream>
 #include <boost/algorithm/string.hpp>
+#include <system_error>
 
 #include "pdns/dnsseckeeper.hh"
 #include "pdns/dnssecinfra.hh"
@@ -815,8 +816,10 @@ void Bind2Backend::loadConfig(string* status)
         }
 
         BB2DomainInfo bbd;
+        bool isNew = false;
 
         if(!safeGetBBDomainInfo(i->name, &bbd)) { 
+          isNew = true;
           bbd.d_id=domain_id++;
           bbd.setCheckInterval(getArgAsNum("check-interval"));
           bbd.d_lastnotified=0;
@@ -848,9 +851,12 @@ void Bind2Backend::loadConfig(string* status)
             L<<Logger::Warning<<d_logprefix<<msg.str()<<endl;
             rejected++;
           }
-          catch(std::exception &ae) {
+          catch(std::system_error &ae) {
             ostringstream msg;
-            msg<<" error at "+nowTime()+" parsing '"<<i->name<<"' from file '"<<i->filename<<"': "<<ae.what();
+            if (ae.code().value() == ENOENT && isNew && i->type == "slave")
+              msg<<" error at "+nowTime()<<" no file found for new slave domain '"<<i->name<<"'. Has not been AXFR'd yet";
+            else
+              msg<<" error at "+nowTime()+" parsing '"<<i->name<<"' from file '"<<i->filename<<"': "<<ae.what();
 
             if(status)
               *status+=msg.str();
index 0de245dcc848325db64bf23d65274d37d08413f6..d1f8bacf794bc954e5ea15a0dc3ae0a06533b37b 100644 (file)
@@ -34,6 +34,7 @@
 #include "zoneparser-tng.hh"
 #include <deque>
 #include <boost/algorithm/string.hpp>
+#include <system_error>
 
 static string g_INstr("IN");
 
@@ -57,8 +58,10 @@ ZoneParserTNG::ZoneParserTNG(const vector<string> zonedata, const DNSName& zname
 void ZoneParserTNG::stackFile(const std::string& fname)
 {
   FILE *fp=fopen(fname.c_str(), "r");
-  if(!fp)
-    throw runtime_error("Unable to open file '"+fname+"': "+stringerror());
+  if(!fp) {
+    std::error_code ec (errno,std::generic_category());
+    throw std::system_error(ec, "Unable to open file '"+fname+"': "+stringerror());
+  }
 
   filestate fs(fp, fname);
   d_filestates.push(fs);