Enhance exception throwing with Boost Exception library

Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4919aa
Refs: #2541
diff --git a/tools/ndn-autoconfig/base-dns.cpp b/tools/ndn-autoconfig/base-dns.cpp
index 60eed48..bcd1f65 100644
--- a/tools/ndn-autoconfig/base-dns.cpp
+++ b/tools/ndn-autoconfig/base-dns.cpp
@@ -68,7 +68,7 @@
                              queryAnswer.buf,
                              sizeof(queryAnswer));
   if (answerSize == 0) {
-    throw Error("No DNS SRV records found for " + srvDomain);
+    BOOST_THROW_EXCEPTION(Error("No DNS SRV records found for " + srvDomain));
   }
   return parseSrvRr(queryAnswer, answerSize);
 }
@@ -96,7 +96,7 @@
                               sizeof(queryAnswer));
 
   if (answerSize == 0) {
-    throw Error("No DNS SRV records found for _ndn._udp");
+    BOOST_THROW_EXCEPTION(Error("No DNS SRV records found for _ndn._udp"));
   }
 
   return parseSrvRr(queryAnswer, answerSize);
@@ -125,7 +125,7 @@
   };
 
   if (ntohs(queryAnswer.header.ancount) == 0) {
-    throw Error("SRV record cannot be parsed");
+    BOOST_THROW_EXCEPTION(Error("SRV record cannot be parsed"));
   }
 
   const uint8_t* blob = queryAnswer.buf + NS_HFIXEDSZ;
@@ -139,7 +139,7 @@
                                  srvName,                       // expanded server name
                                  NS_MAXDNAME);
   if (serverNameSize <= 0) {
-    throw Error("SRV record cannot be parsed (error decoding domain name)");
+    BOOST_THROW_EXCEPTION(Error("SRV record cannot be parsed (error decoding domain name)"));
   }
 
   const srv_t* server = reinterpret_cast<const srv_t*>(&blob[sizeof(rechdr)]);
@@ -154,7 +154,7 @@
                                hostName,                      // expanded host name
                                NS_MAXDNAME);
   if (hostNameSize <= 0) {
-    throw Error("SRV record cannot be parsed (error decoding host name)");
+    BOOST_THROW_EXCEPTION(Error("SRV record cannot be parsed (error decoding host name)"));
   }
 
   std::string uri = "udp://";
diff --git a/tools/ndn-autoconfig/base.cpp b/tools/ndn-autoconfig/base.cpp
index bc14d9a..c896e67 100644
--- a/tools/ndn-autoconfig/base.cpp
+++ b/tools/ndn-autoconfig/base.cpp
@@ -65,7 +65,7 @@
 {
   std::ostringstream os;
   os << "FaceUri canonization failed: " << reason;
-  throw Error(os.str());
+  BOOST_THROW_EXCEPTION(Error(os.str()));
 }
 
 void
@@ -85,7 +85,7 @@
 {
   std::ostringstream os;
   os << "Failed to create face: " << error << " (code: " << code << ")";
-  throw Error(os.str());
+  BOOST_THROW_EXCEPTION(Error(os.str()));
 }
 
 void
@@ -113,7 +113,7 @@
 {
   std::ostringstream os;
   os << "Failed in name registration, " << error << " (code: " << code << ")";
-  throw Error(os.str());
+  BOOST_THROW_EXCEPTION(Error(os.str()));
 }
 
 
diff --git a/tools/ndn-autoconfig/main.cpp b/tools/ndn-autoconfig/main.cpp
index f7eb5db..2216535 100644
--- a/tools/ndn-autoconfig/main.cpp
+++ b/tools/ndn-autoconfig/main.cpp
@@ -72,7 +72,7 @@
                [&] (const std::string& errorMessage) {
                  std::cerr << "Stage 3 failed: " << errorMessage << std::endl;
                  if (!m_isDaemonMode)
-                   throw Error("No more stages, automatic discovery failed");
+                   BOOST_THROW_EXCEPTION(Error("No more stages, automatic discovery failed"));
                  else
                    std::cerr << "No more stages, automatic discovery failed" << std::endl;
                })