Replace all uses of BOOST_THROW_EXCEPTION with NDN_THROW
Refs: #4834
Change-Id: If2455e1830f310beea434ffb455d960e11c4c2ed
diff --git a/daemon/face/ethernet-channel.cpp b/daemon/face/ethernet-channel.cpp
index 691b40b..21949b3 100644
--- a/daemon/face/ethernet-channel.cpp
+++ b/daemon/face/ethernet-channel.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,
@@ -89,7 +89,7 @@
m_socket.assign(m_pcap.getFd());
}
catch (const PcapHelper::Error& e) {
- BOOST_THROW_EXCEPTION(Error(e.what()));
+ NDN_THROW_NESTED(Error(e.what()));
}
updateFilter();
diff --git a/daemon/face/ethernet-factory.cpp b/daemon/face/ethernet-factory.cpp
index 7603343..4d4d295 100644
--- a/daemon/face/ethernet-factory.cpp
+++ b/daemon/face/ethernet-factory.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,
@@ -96,12 +96,12 @@
const std::string& valueStr = value.get_value<std::string>();
mcastConfig.group = ethernet::Address::fromString(valueStr);
if (mcastConfig.group.isNull()) {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("face_system.ether.mcast_group: '" +
- valueStr + "' cannot be parsed as an Ethernet address"));
+ NDN_THROW(ConfigFile::Error("face_system.ether.mcast_group: '" +
+ valueStr + "' cannot be parsed as an Ethernet address"));
}
else if (!mcastConfig.group.isMulticast()) {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("face_system.ether.mcast_group: '" +
- valueStr + "' is not a multicast address"));
+ NDN_THROW(ConfigFile::Error("face_system.ether.mcast_group: '" +
+ valueStr + "' is not a multicast address"));
}
}
else if (key == "mcast_ad_hoc") {
@@ -115,7 +115,7 @@
mcastConfig.netifPredicate.parseBlacklist(value);
}
else {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option face_system.ether." + key));
+ NDN_THROW(ConfigFile::Error("Unrecognized option face_system.ether." + key));
}
}
}
diff --git a/daemon/face/ethernet-transport.cpp b/daemon/face/ethernet-transport.cpp
index 412bcba..ee7193b 100644
--- a/daemon/face/ethernet-transport.cpp
+++ b/daemon/face/ethernet-transport.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,
@@ -55,7 +55,7 @@
m_socket.assign(m_pcap.getFd());
}
catch (const PcapHelper::Error& e) {
- BOOST_THROW_EXCEPTION(Error(e.what()));
+ NDN_THROW_NESTED(Error(e.what()));
}
m_netifStateConn = localEndpoint.onStateChanged.connect(
diff --git a/daemon/face/face-system.cpp b/daemon/face/face-system.cpp
index 79880da..21685f3 100644
--- a/daemon/face/face-system.cpp
+++ b/daemon/face/face-system.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,
@@ -110,7 +110,7 @@
context.generalConfig.wantCongestionMarking = ConfigFile::parseYesNo(pair, "face_system.general");
}
else {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option face_system.general." + key));
+ NDN_THROW(ConfigFile::Error("Unrecognized option face_system.general." + key));
}
}
}
@@ -150,7 +150,7 @@
// const ConfigSection& subSection = pair.second;
if (!seenSections.insert(sectionName).second) {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("Duplicate section face_system." + sectionName));
+ NDN_THROW(ConfigFile::Error("Duplicate section face_system." + sectionName));
}
if (sectionName == SECTION_GENERAL || sectionName == SECTION_NETDEVBOUND ||
@@ -158,7 +158,7 @@
continue;
}
- BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option face_system." + sectionName));
+ NDN_THROW(ConfigFile::Error("Unrecognized option face_system." + sectionName));
}
}
diff --git a/daemon/face/lp-reliability.cpp b/daemon/face/lp-reliability.cpp
index 7b248fb..d46356b 100644
--- a/daemon/face/lp-reliability.cpp
+++ b/daemon/face/lp-reliability.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,
@@ -188,7 +188,7 @@
lp::Sequence txSeq = ++m_lastTxSeqNo;
frag.set<lp::TxSequenceField>(txSeq);
if (m_unackedFrags.size() > 0 && m_lastTxSeqNo == m_firstUnackedFrag->first) {
- BOOST_THROW_EXCEPTION(std::length_error("TxSequence range exceeded"));
+ NDN_THROW(std::length_error("TxSequence range exceeded"));
}
return m_lastTxSeqNo;
}
diff --git a/daemon/face/multicast-ethernet-transport.cpp b/daemon/face/multicast-ethernet-transport.cpp
index 91c25d4..2afb793 100644
--- a/daemon/face/multicast-ethernet-transport.cpp
+++ b/daemon/face/multicast-ethernet-transport.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,
@@ -144,7 +144,7 @@
NFD_LOG_FACE_WARN("ioctl(SIOCADDMULTI) failed: " << std::strerror(errno));
#endif
- BOOST_THROW_EXCEPTION(Error("Failed to join multicast group"));
+ NDN_THROW(Error("Failed to join multicast group"));
}
} // namespace face
diff --git a/daemon/face/multicast-udp-transport.cpp b/daemon/face/multicast-udp-transport.cpp
index db12128..6e99a1c 100644
--- a/daemon/face/multicast-udp-transport.cpp
+++ b/daemon/face/multicast-udp-transport.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,
@@ -124,8 +124,7 @@
#if defined(__linux__) && !defined(__ANDROID__)
PrivilegeHelper::runElevated([=] {
if (::setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, ifname.data(), ifname.size() + 1) < 0) {
- BOOST_THROW_EXCEPTION(MulticastUdpTransport::Error("Cannot bind multicast rx socket to " +
- ifname + ": " + std::strerror(errno)));
+ NDN_THROW_ERRNO(MulticastUdpTransport::Error("Cannot bind multicast rx socket to " + ifname));
}
});
#endif
diff --git a/daemon/face/netdev-bound.cpp b/daemon/face/netdev-bound.cpp
index a47bd43..5ed975d 100644
--- a/daemon/face/netdev-bound.cpp
+++ b/daemon/face/netdev-bound.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,
@@ -53,8 +53,7 @@
rules.push_back(parseRule(ruleIndex++, value));
}
else {
- BOOST_THROW_EXCEPTION(ConfigFile::Error(
- "Unrecognized option face_system.netdev_bound." + key));
+ NDN_THROW(ConfigFile::Error("Unrecognized option face_system.netdev_bound." + key));
}
}
}
@@ -70,8 +69,8 @@
for (const FaceUri& remote : rule.remotes) {
std::string devScheme = remote.getScheme() + "+dev";
if (!m_faceSystem.hasFactoryForScheme(devScheme)) {
- BOOST_THROW_EXCEPTION(RuleParseError(
- i, "scheme " + devScheme + " for " + remote.toString() + " is unavailable"));
+ NDN_THROW(RuleParseError(i, "scheme '" + devScheme + "' for " +
+ remote.toString() + " is unavailable"));
}
}
}
@@ -102,44 +101,44 @@
try {
rule.remotes.emplace_back(value.get_value<std::string>());
}
- catch (const FaceUri::Error& ex) {
- BOOST_THROW_EXCEPTION(RuleParseError(index, "invalid remote FaceUri", ex.what()));
+ catch (const FaceUri::Error&) {
+ NDN_THROW_NESTED(RuleParseError(index, "invalid remote FaceUri"));
}
if (!rule.remotes.back().isCanonical()) {
- BOOST_THROW_EXCEPTION(RuleParseError(index, "remote FaceUri is not canonical"));
+ NDN_THROW(RuleParseError(index, "remote FaceUri is not canonical"));
}
}
else if (key == "whitelist") {
if (hasWhitelist) {
- BOOST_THROW_EXCEPTION(RuleParseError(index, "duplicate whitelist"));
+ NDN_THROW(RuleParseError(index, "duplicate whitelist"));
}
try {
rule.netifPredicate.parseWhitelist(value);
}
- catch (const ConfigFile::Error& ex) {
- BOOST_THROW_EXCEPTION(RuleParseError(index, "invalid whitelist", ex.what()));
+ catch (const ConfigFile::Error&) {
+ NDN_THROW_NESTED(RuleParseError(index, "invalid whitelist"));
}
hasWhitelist = true;
}
else if (key == "blacklist") {
if (hasBlacklist) {
- BOOST_THROW_EXCEPTION(RuleParseError(index, "duplicate blacklist"));
+ NDN_THROW(RuleParseError(index, "duplicate blacklist"));
}
try {
rule.netifPredicate.parseBlacklist(value);
}
- catch (const ConfigFile::Error& ex) {
- BOOST_THROW_EXCEPTION(RuleParseError(index, "invalid blacklist", ex.what()));
+ catch (const ConfigFile::Error&) {
+ NDN_THROW_NESTED(RuleParseError(index, "invalid blacklist"));
}
hasBlacklist = true;
}
else {
- BOOST_THROW_EXCEPTION(RuleParseError(index, "unrecognized option " + key));
+ NDN_THROW(RuleParseError(index, "unrecognized option " + key));
}
}
if (rule.remotes.empty()) {
- BOOST_THROW_EXCEPTION(RuleParseError(index, "remote FaceUri is missing"));
+ NDN_THROW(RuleParseError(index, "remote FaceUri is missing"));
}
///\todo #3521 for each remote, check that there is a factory providing scheme+dev scheme
diff --git a/daemon/face/netdev-bound.hpp b/daemon/face/netdev-bound.hpp
index 17a6ce8..6297afd 100644
--- a/daemon/face/netdev-bound.hpp
+++ b/daemon/face/netdev-bound.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,
@@ -48,11 +48,6 @@
{
}
- RuleParseError(int index, std::string msg, const char* innerMsg)
- : RuleParseError(index, msg + " - " + innerMsg)
- {
- }
-
public:
int index;
std::string msg;
diff --git a/daemon/face/pcap-helper.cpp b/daemon/face/pcap-helper.cpp
index 072f75e..4b474e6 100644
--- a/daemon/face/pcap-helper.cpp
+++ b/daemon/face/pcap-helper.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,
@@ -41,14 +41,14 @@
char errbuf[PCAP_ERRBUF_SIZE] = {};
m_pcap = pcap_create(interfaceName.data(), errbuf);
if (!m_pcap)
- BOOST_THROW_EXCEPTION(Error("pcap_create: " + std::string(errbuf)));
+ NDN_THROW(Error("pcap_create: " + std::string(errbuf)));
// Enable "immediate mode", effectively disabling any read buffering in the kernel.
// This corresponds to the BIOCIMMEDIATE ioctl on BSD-like systems (including macOS)
// where libpcap uses a BPF device. On Linux this forces libpcap not to use TPACKET_V3,
// even if the kernel supports it, thus preventing bug #1511.
if (pcap_set_immediate_mode(m_pcap, 1) < 0)
- BOOST_THROW_EXCEPTION(Error("pcap_set_immediate_mode failed"));
+ NDN_THROW(Error("pcap_set_immediate_mode failed"));
}
PcapHelper::~PcapHelper()
@@ -61,13 +61,13 @@
{
int ret = pcap_activate(m_pcap);
if (ret < 0)
- BOOST_THROW_EXCEPTION(Error("pcap_activate: " + std::string(pcap_statustostr(ret))));
+ NDN_THROW(Error("pcap_activate: " + std::string(pcap_statustostr(ret))));
if (pcap_set_datalink(m_pcap, dlt) < 0)
- BOOST_THROW_EXCEPTION(Error("pcap_set_datalink: " + getLastError()));
+ NDN_THROW(Error("pcap_set_datalink: " + getLastError()));
if (pcap_setdirection(m_pcap, PCAP_D_IN) < 0)
- BOOST_THROW_EXCEPTION(Error("pcap_setdirection: " + getLastError()));
+ NDN_THROW(Error("pcap_setdirection: " + getLastError()));
}
void
@@ -84,7 +84,7 @@
{
int fd = pcap_get_selectable_fd(m_pcap);
if (fd < 0)
- BOOST_THROW_EXCEPTION(Error("pcap_get_selectable_fd failed"));
+ NDN_THROW(Error("pcap_get_selectable_fd failed"));
// we need to duplicate the fd, otherwise both pcap_close() and the
// caller may attempt to close the same fd and one of them will fail
@@ -102,7 +102,7 @@
{
pcap_stat ps{};
if (pcap_stats(m_pcap, &ps) < 0)
- BOOST_THROW_EXCEPTION(Error("pcap_stats: " + getLastError()));
+ NDN_THROW(Error("pcap_stats: " + getLastError()));
return ps.ps_drop;
}
@@ -112,12 +112,12 @@
{
bpf_program prog;
if (pcap_compile(m_pcap, &prog, filter, 1, PCAP_NETMASK_UNKNOWN) < 0)
- BOOST_THROW_EXCEPTION(Error("pcap_compile: " + getLastError()));
+ NDN_THROW(Error("pcap_compile: " + getLastError()));
int ret = pcap_setfilter(m_pcap, &prog);
pcap_freecode(&prog);
if (ret < 0)
- BOOST_THROW_EXCEPTION(Error("pcap_setfilter: " + getLastError()));
+ NDN_THROW(Error("pcap_setfilter: " + getLastError()));
}
std::tuple<const uint8_t*, size_t, std::string>
diff --git a/daemon/face/protocol-factory.cpp b/daemon/face/protocol-factory.cpp
index cdb6cb1..5acb18f 100644
--- a/daemon/face/protocol-factory.cpp
+++ b/daemon/face/protocol-factory.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,
@@ -114,7 +114,7 @@
ProtocolFactory::doCreateNetdevBoundFace(const FaceUri&,
const shared_ptr<const ndn::net::NetworkInterface>&)
{
- BOOST_THROW_EXCEPTION(Error("This protocol factory does not support netdev-bound faces"));
+ NDN_THROW(Error("This protocol factory does not support netdev-bound faces"));
}
std::vector<shared_ptr<const Channel>>
diff --git a/daemon/face/tcp-factory.cpp b/daemon/face/tcp-factory.cpp
index d77b639..f45d786 100644
--- a/daemon/face/tcp-factory.cpp
+++ b/daemon/face/tcp-factory.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,
@@ -94,12 +94,12 @@
local.parseBlacklist(localPair.second);
}
else {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option face_system.tcp.local." + localKey));
+ NDN_THROW(ConfigFile::Error("Unrecognized option face_system.tcp.local." + localKey));
}
}
}
else {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option face_system.tcp." + key));
+ NDN_THROW(ConfigFile::Error("Unrecognized option face_system.tcp." + key));
}
}
if (!isLocalConfigured) {
@@ -107,7 +107,7 @@
}
if (!enableV4 && !enableV6) {
- BOOST_THROW_EXCEPTION(ConfigFile::Error(
+ NDN_THROW(ConfigFile::Error(
"IPv4 and IPv6 TCP channels have been disabled. Remove face_system.tcp section to disable "
"TCP channels or enable at least one channel type."));
}
diff --git a/daemon/face/transport.cpp b/daemon/face/transport.cpp
index c08990a..e93480f 100644
--- a/daemon/face/transport.cpp
+++ b/daemon/face/transport.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,
@@ -201,7 +201,7 @@
}
if (!isValid) {
- BOOST_THROW_EXCEPTION(std::runtime_error("invalid state transition"));
+ NDN_THROW(std::runtime_error("Invalid state transition"));
}
NFD_LOG_FACE_INFO("setState " << m_state << " -> " << newState);
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index 6c261fb..6730389 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.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,
@@ -124,12 +124,12 @@
boost::system::error_code ec;
mcastConfig.group.address(ip::address_v4::from_string(valueStr, ec));
if (ec) {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("face_system.udp.mcast_group: '" +
- valueStr + "' cannot be parsed as an IPv4 address"));
+ NDN_THROW(ConfigFile::Error("face_system.udp.mcast_group: '" +
+ valueStr + "' cannot be parsed as an IPv4 address"));
}
else if (!mcastConfig.group.address().is_multicast()) {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("face_system.udp.mcast_group: '" +
- valueStr + "' is not a multicast address"));
+ NDN_THROW(ConfigFile::Error("face_system.udp.mcast_group: '" +
+ valueStr + "' is not a multicast address"));
}
}
else if (key == "mcast_port") {
@@ -140,12 +140,12 @@
boost::system::error_code ec;
mcastConfig.groupV6.address(ip::address_v6::from_string(valueStr, ec));
if (ec) {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("face_system.udp.mcast_group_v6: '" +
- valueStr + "' cannot be parsed as an IPv6 address"));
+ NDN_THROW(ConfigFile::Error("face_system.udp.mcast_group_v6: '" +
+ valueStr + "' cannot be parsed as an IPv6 address"));
}
else if (!mcastConfig.groupV6.address().is_multicast()) {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("face_system.udp.mcast_group_v6: '" +
- valueStr + "' is not a multicast address"));
+ NDN_THROW(ConfigFile::Error("face_system.udp.mcast_group_v6: '" +
+ valueStr + "' is not a multicast address"));
}
}
else if (key == "mcast_port_v6") {
@@ -162,12 +162,12 @@
mcastConfig.netifPredicate.parseBlacklist(value);
}
else {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option face_system.udp." + key));
+ NDN_THROW(ConfigFile::Error("Unrecognized option face_system.udp." + key));
}
}
if (!enableV4 && !enableV6 && !mcastConfig.isEnabled) {
- BOOST_THROW_EXCEPTION(ConfigFile::Error(
+ NDN_THROW(ConfigFile::Error(
"IPv4 and IPv6 UDP channels and UDP multicast have been disabled. "
"Remove face_system.udp section to disable UDP channels or enable at least one of them."));
}
@@ -298,9 +298,8 @@
// check if the endpoint is already used by a multicast face
if (m_mcastFaces.find(localEndpoint) != m_mcastFaces.end()) {
- BOOST_THROW_EXCEPTION(Error("Cannot create UDP channel on " +
- boost::lexical_cast<std::string>(localEndpoint) +
- ", endpoint already allocated for a UDP multicast face"));
+ NDN_THROW(Error("Cannot create UDP channel on " + boost::lexical_cast<std::string>(localEndpoint) +
+ ", endpoint already allocated to a UDP multicast face"));
}
auto channel = std::make_shared<UdpChannel>(localEndpoint, idleTimeout, m_wantCongestionMarking);
@@ -338,16 +337,14 @@
if (it->second->getRemoteUri() == FaceUri(mcastEp))
return it->second;
else
- BOOST_THROW_EXCEPTION(Error("Cannot create UDP multicast face on " +
- boost::lexical_cast<std::string>(localEp) +
- ", endpoint already allocated for a different UDP multicast face"));
+ NDN_THROW(Error("Cannot create UDP multicast face on " + boost::lexical_cast<std::string>(localEp) +
+ ", endpoint already allocated to a different UDP multicast face"));
}
// check if the local endpoint is already used by a unicast channel
if (m_channels.find(localEp) != m_channels.end()) {
- BOOST_THROW_EXCEPTION(Error("Cannot create UDP multicast face on " +
- boost::lexical_cast<std::string>(localEp) +
- ", endpoint already allocated for a UDP channel"));
+ NDN_THROW(Error("Cannot create UDP multicast face on " + boost::lexical_cast<std::string>(localEp) +
+ ", endpoint already allocated to a UDP channel"));
}
ip::udp::socket rxSock(getGlobalIoService());
diff --git a/daemon/face/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index 8c58c55..172f797 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.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,
@@ -82,8 +82,7 @@
NFD_LOG_CHAN_TRACE("connect() on existing socket file returned: " << error.message());
if (!error) {
// someone answered, leave the socket alone
- BOOST_THROW_EXCEPTION(Error("Socket file at " + m_endpoint.path()
- + " belongs to another NFD process"));
+ NDN_THROW(Error("Socket file at " + m_endpoint.path() + " belongs to another NFD process"));
}
else if (error == boost::asio::error::connection_refused ||
error == boost::asio::error::timed_out) {
@@ -94,7 +93,7 @@
}
}
else if (type != fs::file_not_found) {
- BOOST_THROW_EXCEPTION(Error(m_endpoint.path() + " already exists and is not a socket file"));
+ NDN_THROW(Error(m_endpoint.path() + " already exists and is not a socket file"));
}
m_acceptor.open();
@@ -102,7 +101,7 @@
m_acceptor.listen(backlog);
if (::chmod(m_endpoint.path().data(), 0666) < 0) {
- BOOST_THROW_EXCEPTION(Error("chmod(" + m_endpoint.path() + ") failed: " + std::strerror(errno)));
+ NDN_THROW_ERRNO(Error("Failed to chmod " + m_endpoint.path()));
}
accept(onFaceCreated, onAcceptFailed);
diff --git a/daemon/face/unix-stream-factory.cpp b/daemon/face/unix-stream-factory.cpp
index 211203a..faa406c 100644
--- a/daemon/face/unix-stream-factory.cpp
+++ b/daemon/face/unix-stream-factory.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,
@@ -68,7 +68,7 @@
path = value.get_value<std::string>();
}
else {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option face_system.unix." + key));
+ NDN_THROW(ConfigFile::Error("Unrecognized option face_system.unix." + key));
}
}
diff --git a/daemon/face/websocket-factory.cpp b/daemon/face/websocket-factory.cpp
index e3d8d57..49e5740 100644
--- a/daemon/face/websocket-factory.cpp
+++ b/daemon/face/websocket-factory.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,
@@ -75,13 +75,13 @@
enableV6 = ConfigFile::parseYesNo(pair, "face_system.websocket");
}
else {
- BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option face_system.websocket." + key));
+ NDN_THROW(ConfigFile::Error("Unrecognized option face_system.websocket." + key));
}
}
}
if (!enableV4 && !enableV6) {
- BOOST_THROW_EXCEPTION(ConfigFile::Error(
+ NDN_THROW(ConfigFile::Error(
"IPv4 and IPv6 WebSocket channels have been disabled. Remove face_system.websocket section "
"to disable WebSocket channels or enable at least one channel type."));
}