Migrate to C++17 and misc code cleanups

Change-Id: I6b63385c92361a7ef5803d2bfd00f39c77e88d34
diff --git a/src/repo.cpp b/src/repo.cpp
index 4a4a8b5..8ee393f 100644
--- a/src/repo.cpp
+++ b/src/repo.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -34,16 +34,16 @@
   }
 
   std::ifstream fin(configPath.c_str());
- if (!fin.is_open())
-    BOOST_THROW_EXCEPTION(Repo::Error("failed to open configuration file '" + configPath + "'"));
+  if (!fin.is_open())
+    NDN_THROW(Repo::Error("failed to open configuration file '" + configPath + "'"));
 
   using namespace boost::property_tree;
   ptree propertyTree;
   try {
     read_info(fin, propertyTree);
   }
-  catch (const ptree_error& e) {
-    BOOST_THROW_EXCEPTION(Repo::Error("failed to read configuration file '" + configPath + "'"));
+  catch (const ptree_error&) {
+    NDN_THROW_NESTED(Repo::Error("failed to read configuration file '" + configPath + "'"));
   }
 
   ptree repoConf = propertyTree.get_child("repo");
@@ -58,8 +58,8 @@
     else if (section.first == "registration-subset")
       repoConfig.registrationSubset = section.second.get_value<int>();
     else
-      BOOST_THROW_EXCEPTION(Repo::Error("Unrecognized '" + section.first + "' option in 'data' section in "
-                                        "configuration file '"+ configPath +"'"));
+      NDN_THROW(Repo::Error("Unrecognized '" + section.first + "' option in 'data' section in "
+                            "configuration file '"+ configPath +"'"));
   }
 
   ptree commandConf = repoConf.get_child("command");
@@ -67,8 +67,8 @@
     if (section.first == "prefix")
       repoConfig.repoPrefixes.push_back(Name(section.second.get_value<std::string>()));
     else
-      BOOST_THROW_EXCEPTION(Repo::Error("Unrecognized '" + section.first + "' option in 'command' section in "
-                                        "configuration file '"+ configPath +"'"));
+      NDN_THROW(Repo::Error("Unrecognized '" + section.first + "' option in 'command' section in "
+                            "configuration file '"+ configPath +"'"));
   }
 
   auto tcpBulkInsert = repoConf.get_child_optional("tcp_bulk_insert");
@@ -85,8 +85,8 @@
         port = section.second.get_value<std::string>();
       }
       else
-        BOOST_THROW_EXCEPTION(Repo::Error("Unrecognized '" + section.first + "' option in 'tcp_bulk_insert' section in "
-                                          "configuration file '"+ configPath +"'"));
+        NDN_THROW(Repo::Error("Unrecognized '" + section.first + "' option in 'tcp_bulk_insert' section in "
+                              "configuration file '" + configPath + "'"));
     }
   }
   if (isTcpBulkEnabled) {
@@ -94,7 +94,7 @@
   }
 
   if (repoConf.get<std::string>("storage.method") != "sqlite") {
-    BOOST_THROW_EXCEPTION(Repo::Error("Only 'sqlite' storage method is supported"));
+    NDN_THROW(Repo::Error("Only 'sqlite' storage method is supported"));
   }
 
   repoConfig.dbPath = repoConf.get<std::string>("storage.path");
@@ -127,10 +127,10 @@
 Repo::initializeStorage()
 {
   // Rebuild storage if storage checkpoin exists
-  ndn::time::steady_clock::TimePoint start = ndn::time::steady_clock::now();
-  ndn::time::steady_clock::TimePoint end = ndn::time::steady_clock::now();
-  ndn::time::milliseconds cost = ndn::time::duration_cast<ndn::time::milliseconds>(end - start);
-  NDN_LOG_DEBUG("initialize storage cost: " << cost << "ms");
+  auto start = time::steady_clock::now();
+  auto end = time::steady_clock::now();
+  auto cost = time::duration_cast<time::milliseconds>(end - start);
+  NDN_LOG_DEBUG("initialize storage cost: " << cost);
 }
 
 void
@@ -144,7 +144,7 @@
     m_face.registerPrefix(cmdPrefix, nullptr,
       [] (const Name& cmdPrefix, const std::string& reason) {
         NDN_LOG_DEBUG("Command prefix " << cmdPrefix << " registration error: " << reason);
-        BOOST_THROW_EXCEPTION(Error("Command prefix registration failed"));
+        NDN_THROW(Error("Command prefix registration failed"));
       });
 
     m_dispatcher.addTopPrefix(cmdPrefix);