Replace all uses of BOOST_THROW_EXCEPTION with NDN_THROW

Refs: #4834
Change-Id: If2455e1830f310beea434ffb455d960e11c4c2ed
diff --git a/core/common.hpp b/core/common.hpp
index 2678a17..93c2933 100644
--- a/core/common.hpp
+++ b/core/common.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -65,6 +65,7 @@
 #include <ndn-cxx/lp/nack.hpp>
 #include <ndn-cxx/net/face-uri.hpp>
 #include <ndn-cxx/util/backports.hpp>
+#include <ndn-cxx/util/exception.hpp>
 #include <ndn-cxx/util/signal.hpp>
 
 #include <boost/asio.hpp>
@@ -72,7 +73,6 @@
 #include <boost/lexical_cast.hpp>
 #include <boost/noncopyable.hpp>
 #include <boost/property_tree/ptree.hpp>
-#include <boost/throw_exception.hpp>
 
 namespace nfd {
 
diff --git a/core/config-file.cpp b/core/config-file.cpp
index 548d351..accfe72 100644
--- a/core/config-file.cpp
+++ b/core/config-file.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,6 +26,7 @@
 #include "config-file.hpp"
 
 #include <boost/property_tree/info_parser.hpp>
+
 #include <fstream>
 #include <sstream>
 
@@ -42,8 +43,8 @@
                                        const ConfigSection& section,
                                        bool isDryRun)
 {
-  BOOST_THROW_EXCEPTION(Error("Error processing configuration file " + filename +
-                              ": no module subscribed for section \"" + sectionName + "\""));
+  NDN_THROW(Error("Error processing configuration file " + filename +
+                  ": no module subscribed for section '" + sectionName + "'"));
 }
 
 void
@@ -68,8 +69,8 @@
     return false;
   }
 
-  BOOST_THROW_EXCEPTION(Error("Invalid value \"" + value + "\" for option \"" +
-                              key + "\" in \"" + sectionName + "\" section"));
+  NDN_THROW(Error("Invalid value '" + value + "' for option '" +
+                  key + "' in section '" + sectionName + "'"));
 }
 
 void
@@ -84,7 +85,7 @@
 {
   std::ifstream inputFile(filename);
   if (!inputFile.good() || !inputFile.is_open()) {
-    BOOST_THROW_EXCEPTION(Error("Failed to read configuration file " + filename));
+    NDN_THROW(Error("Failed to read configuration file " + filename));
   }
   parse(inputFile, isDryRun, filename);
   inputFile.close();
@@ -104,8 +105,8 @@
     boost::property_tree::read_info(input, m_global);
   }
   catch (const boost::property_tree::info_parser_error& error) {
-    BOOST_THROW_EXCEPTION(Error("Failed to parse configuration file " + filename +
-                                ": " + error.message() + " on line " + to_string(error.line())));
+    NDN_THROW(Error("Failed to parse configuration file " + filename +
+                    ": " + error.message() + " on line " + to_string(error.line())));
   }
 
   process(isDryRun, filename);
diff --git a/core/config-file.hpp b/core/config-file.hpp
index d51b1e9..819b9b4 100644
--- a/core/config-file.hpp
+++ b/core/config-file.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -60,11 +60,7 @@
   class Error : public std::runtime_error
   {
   public:
-    explicit
-    Error(const std::string& what)
-      : std::runtime_error(what)
-    {
-    }
+    using std::runtime_error::runtime_error;
   };
 
   explicit
@@ -115,8 +111,8 @@
     if (value) {
       return *value;
     }
-    BOOST_THROW_EXCEPTION(Error("Invalid value \"" + node.get_value<std::string>() +
-                                "\" for option \"" + key + "\" in \"" + sectionName + "\" section"));
+    NDN_THROW(Error("Invalid value '" + node.get_value<std::string>() +
+                    "' for option '" + key + "' in section '" + sectionName + "'"));
   }
 
   template <typename T>
diff --git a/core/log-config-section.cpp b/core/log-config-section.cpp
index 6f6f0ab..9d8168c 100644
--- a/core/log-config-section.cpp
+++ b/core/log-config-section.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -37,8 +37,8 @@
   try {
     return ndn::util::parseLogLevel(item.get_value<std::string>());
   }
-  catch (const std::invalid_argument& e) {
-    BOOST_THROW_EXCEPTION(ConfigFile::Error("Invalid setting for log." + key + ": " + e.what()));
+  catch (const std::invalid_argument&) {
+    NDN_THROW_NESTED(ConfigFile::Error("Invalid log level for '" + key + "' in section 'log'"));
   }
 }
 
diff --git a/core/network-predicate.cpp b/core/network-predicate.cpp
index d10a5e3..43a0d40 100644
--- a/core/network-predicate.cpp
+++ b/core/network-predicate.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -47,7 +47,9 @@
 }
 
 void
-NetworkPredicateBase::parseList(std::set<std::string>& set, const boost::property_tree::ptree& list, const std::string& section)
+NetworkPredicateBase::parseList(std::set<std::string>& set,
+                                const boost::property_tree::ptree& list,
+                                const std::string& section)
 {
   set.clear();
 
@@ -58,12 +60,14 @@
     }
     else {
       if (!isRuleSupported(item.first)) {
-        BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized rule \"" + item.first + "\" in \"" + section + "\" section"));
+        NDN_THROW(ConfigFile::Error("Unrecognized rule '" + item.first +
+                                    "' in section '" + section + "'"));
       }
 
       auto value = item.second.get_value<std::string>();
       if (!isRuleValid(item.first, value)) {
-        BOOST_THROW_EXCEPTION(ConfigFile::Error("Malformed " + item.first + " \"" + value + "\" in \"" + section + "\" section"));
+        NDN_THROW(ConfigFile::Error("Malformed " + item.first + " '" + value +
+                                    "' in section '" + section + "'"));
       }
       set.insert(value);
     }
@@ -71,7 +75,8 @@
 }
 
 void
-NetworkPredicateBase::parseList(std::set<std::string>& set, std::initializer_list<std::pair<std::string, std::string>> list)
+NetworkPredicateBase::parseList(std::set<std::string>& set,
+                                std::initializer_list<std::pair<std::string, std::string>> list)
 {
   set.clear();
 
@@ -82,11 +87,11 @@
     }
     else {
       if (!isRuleSupported(item.first)) {
-        BOOST_THROW_EXCEPTION(std::runtime_error("Unrecognized rule \"" + item.first + "\""));
+        NDN_THROW(std::runtime_error("Unrecognized rule '" + item.first + "'"));
       }
 
       if (!isRuleValid(item.first, item.second)) {
-        BOOST_THROW_EXCEPTION(std::runtime_error("Malformed " + item.first + " \"" + item.second + "\""));
+        NDN_THROW(std::runtime_error("Malformed " + item.first + " '" + item.second + "'"));
       }
       set.insert(item.second);
     }
@@ -135,7 +140,7 @@
     return Network::isValidCidr(value);
   }
   else {
-    BOOST_THROW_EXCEPTION(std::logic_error("Only supported rules are expected"));
+    NDN_THROW(std::logic_error("Only supported rules are expected"));
   }
 }
 
@@ -153,7 +158,7 @@
     return Network::isValidCidr(value);
   }
   else {
-    BOOST_THROW_EXCEPTION(std::logic_error("Only supported rules are expected"));
+    NDN_THROW(std::logic_error("Only supported rules are expected"));
   }
 }
 
diff --git a/core/privilege-helper.hpp b/core/privilege-helper.hpp
index bbf08e2..0379b2f 100644
--- a/core/privilege-helper.hpp
+++ b/core/privilege-helper.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -38,7 +38,7 @@
   /** \brief represents a serious seteuid/gid failure
    *
    *  This should only be caught by main as part of a graceful program termination.
-   *  \note This is not an std::exception and BOOST_THROW_EXCEPTION should not be used.
+   *  \note This is not an std::exception and NDN_THROW should not be used.
    */
   class Error
   {