Replace all uses of BOOST_THROW_EXCEPTION with NDN_THROW
Refs: #4834
Change-Id: I1851f0b03f1192763b367ee6afba6860717420e7
diff --git a/core/common.hpp b/core/common.hpp
index 4e76a6b..5a45420 100644
--- a/core/common.hpp
+++ b/core/common.hpp
@@ -57,7 +57,6 @@
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options/parsers.hpp>
-#include <boost/throw_exception.hpp>
#include <ndn-cxx/data.hpp>
#include <ndn-cxx/face.hpp>
@@ -65,6 +64,7 @@
#include <ndn-cxx/name.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/util/backports.hpp>
+#include <ndn-cxx/util/exception.hpp>
#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/signal.hpp>
#include <ndn-cxx/util/time.hpp>
diff --git a/tools/chunks/catchunks/consumer.cpp b/tools/chunks/catchunks/consumer.cpp
index 974e8e0..0106629 100644
--- a/tools/chunks/catchunks/consumer.cpp
+++ b/tools/chunks/catchunks/consumer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2018, Regents of the University of California,
+ * Copyright (c) 2016-2019, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -48,10 +48,10 @@
m_discover->onDiscoverySuccess.connect([this] (const Data& data) {
m_pipeline->run(data,
[this] (const Data& data) { handleData(data); },
- [] (const std::string& msg) { BOOST_THROW_EXCEPTION(std::runtime_error(msg)); });
+ [] (const std::string& msg) { NDN_THROW(std::runtime_error(msg)); });
});
m_discover->onDiscoveryFailure.connect([] (const std::string& msg) {
- BOOST_THROW_EXCEPTION(std::runtime_error(msg));
+ NDN_THROW(std::runtime_error(msg));
});
m_discover->run();
}
@@ -64,7 +64,7 @@
m_validator.validate(data,
[this, dataPtr] (const Data& data) {
if (data.getContentType() == ndn::tlv::ContentType_Nack) {
- BOOST_THROW_EXCEPTION(ApplicationNackError(data));
+ NDN_THROW(ApplicationNackError(data));
}
// 'data' passed to callback comes from DataValidationState and was not created with make_shared
@@ -72,7 +72,7 @@
writeInOrderData();
},
[] (const Data&, const security::v2::ValidationError& error) {
- BOOST_THROW_EXCEPTION(DataValidationError(error));
+ NDN_THROW(DataValidationError(error));
});
}
diff --git a/tools/dump/ndndump.cpp b/tools/dump/ndndump.cpp
index 2be64f9..b13b7ef 100644
--- a/tools/dump/ndndump.cpp
+++ b/tools/dump/ndndump.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2011-2018, Regents of the University of California.
+ * Copyright (c) 2011-2019, Regents of the University of California.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -99,7 +99,7 @@
const char* defaultDevice = pcap_lookupdev(errbuf);
if (defaultDevice == nullptr) {
- BOOST_THROW_EXCEPTION(Error(errbuf));
+ NDN_THROW(Error(errbuf));
}
interface = defaultDevice;
@@ -109,14 +109,14 @@
if (!interface.empty()) {
m_pcap = pcap_open_live(interface.data(), 65535, wantPromisc, 1000, errbuf);
if (m_pcap == nullptr) {
- BOOST_THROW_EXCEPTION(Error("Cannot open interface " + interface + ": " + errbuf));
+ NDN_THROW(Error("Cannot open interface " + interface + ": " + errbuf));
}
action = "listening on " + interface;
}
else {
m_pcap = pcap_open_offline(inputFile.data(), errbuf);
if (m_pcap == nullptr) {
- BOOST_THROW_EXCEPTION(Error("Cannot open file '" + inputFile + "' for reading: " + errbuf));
+ NDN_THROW(Error("Cannot open file '" + inputFile + "' for reading: " + errbuf));
}
action = "reading from file " + inputFile;
}
@@ -138,7 +138,7 @@
// we know how to handle these
break;
default:
- BOOST_THROW_EXCEPTION(Error("Unsupported link-layer header type " + formattedDlt));
+ NDN_THROW(Error("Unsupported link-layer header type " + formattedDlt));
}
if (!pcapFilter.empty()) {
@@ -149,13 +149,13 @@
bpf_program program;
int res = pcap_compile(m_pcap, &program, pcapFilter.data(), 1, PCAP_NETMASK_UNKNOWN);
if (res < 0) {
- BOOST_THROW_EXCEPTION(Error("Cannot compile pcap filter '" + pcapFilter + "': " + pcap_geterr(m_pcap)));
+ NDN_THROW(Error("Cannot compile pcap filter '" + pcapFilter + "': " + pcap_geterr(m_pcap)));
}
res = pcap_setfilter(m_pcap, &program);
pcap_freecode(&program);
if (res < 0) {
- BOOST_THROW_EXCEPTION(Error("Cannot set pcap filter: "s + pcap_geterr(m_pcap)));
+ NDN_THROW(Error("Cannot set pcap filter: "s + pcap_geterr(m_pcap)));
}
}
@@ -164,7 +164,7 @@
};
if (pcap_loop(m_pcap, -1, callback, reinterpret_cast<uint8_t*>(this)) < 0) {
- BOOST_THROW_EXCEPTION(Error("pcap_loop: "s + pcap_geterr(m_pcap)));
+ NDN_THROW(Error("pcap_loop: "s + pcap_geterr(m_pcap)));
}
}
diff --git a/tools/ping/server/ping-server.cpp b/tools/ping/server/ping-server.cpp
index 4162b05..ad8177c 100644
--- a/tools/ping/server/ping-server.cpp
+++ b/tools/ping/server/ping-server.cpp
@@ -46,7 +46,7 @@
Name(m_options.prefix).append("ping"),
bind(&PingServer::onInterest, this, _2),
[] (const auto&, const auto& reason) {
- BOOST_THROW_EXCEPTION(std::runtime_error("Failed to register prefix: " + reason));
+ NDN_THROW(std::runtime_error("Failed to register prefix: " + reason));
});
}