Replace all uses of BOOST_THROW_EXCEPTION with NDN_THROW
Refs: #4834
Change-Id: If2455e1830f310beea434ffb455d960e11c4c2ed
diff --git a/tools/ndn-autoconfig/dns-srv.cpp b/tools/ndn-autoconfig/dns-srv.cpp
index f099295..574ef17 100644
--- a/tools/ndn-autoconfig/dns-srv.cpp
+++ b/tools/ndn-autoconfig/dns-srv.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,
@@ -78,7 +78,7 @@
uint16_t ancount = queryAnswer.header.ancount;
if (boost::endian::big_to_native(ancount) == 0) {
- BOOST_THROW_EXCEPTION(DnsSrvError("SRV record cannot be parsed"));
+ NDN_THROW(DnsSrvError("SRV record cannot be parsed"));
}
const uint8_t* blob = queryAnswer.buf + NS_HFIXEDSZ;
@@ -91,7 +91,7 @@
srvName, // expanded server name
NS_MAXDNAME);
if (serverNameSize <= 0) {
- BOOST_THROW_EXCEPTION(DnsSrvError("SRV record cannot be parsed (error decoding domain name)"));
+ NDN_THROW(DnsSrvError("SRV record cannot be parsed (error decoding domain name)"));
}
const srv_t* server = reinterpret_cast<const srv_t*>(&blob[sizeof(rechdr)]);
@@ -106,7 +106,7 @@
hostName, // expanded host name
NS_MAXDNAME);
if (hostNameSize <= 0) {
- BOOST_THROW_EXCEPTION(DnsSrvError("SRV record cannot be parsed (error decoding host name)"));
+ NDN_THROW(DnsSrvError("SRV record cannot be parsed (error decoding host name)"));
}
return "udp://"s + hostName + ":" + to_string(port);
@@ -131,7 +131,7 @@
queryAnswer.buf,
sizeof(queryAnswer));
if (answerSize == 0) {
- BOOST_THROW_EXCEPTION(DnsSrvError("No DNS SRV records found for " + srvDomain));
+ NDN_THROW(DnsSrvError("No DNS SRV records found for " + srvDomain));
}
return parseSrvRr(queryAnswer, answerSize);
}
@@ -159,7 +159,7 @@
sizeof(queryAnswer));
if (answerSize == 0) {
- BOOST_THROW_EXCEPTION(DnsSrvError("No DNS SRV records found for _ndn._udp"));
+ NDN_THROW(DnsSrvError("No DNS SRV records found for _ndn._udp"));
}
return parseSrvRr(queryAnswer, answerSize);
diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.cpp b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
index abb934f..879ea8e 100644
--- a/tools/ndn-autoconfig/ndn-fch-discovery.cpp
+++ b/tools/ndn-autoconfig/ndn-fch-discovery.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,
@@ -154,15 +154,15 @@
Url url(m_url);
if (!url.isValid()) {
- BOOST_THROW_EXCEPTION(HttpException("Invalid NDN-FCH URL: " + m_url));
+ NDN_THROW(HttpException("Invalid NDN-FCH URL: " + m_url));
}
if (!boost::iequals(url.getScheme(), "http")) {
- BOOST_THROW_EXCEPTION(HttpException("Only http:// NDN-FCH URLs are supported"));
+ NDN_THROW(HttpException("Only http:// NDN-FCH URLs are supported"));
}
requestStream.connect(url.getHost(), url.getPort());
if (!requestStream) {
- BOOST_THROW_EXCEPTION(HttpException("HTTP connection error to " + m_url));
+ NDN_THROW(HttpException("HTTP connection error to " + m_url));
}
requestStream << "GET " << url.getPath() << " HTTP/1.0\r\n";
@@ -175,7 +175,7 @@
std::string statusLine;
std::getline(requestStream, statusLine);
if (!requestStream) {
- BOOST_THROW_EXCEPTION(HttpException("HTTP communication error"));
+ NDN_THROW(HttpException("HTTP communication error"));
}
std::stringstream responseStream(statusLine);
@@ -187,11 +187,11 @@
std::getline(responseStream, statusMessage);
if (!static_cast<bool>(requestStream) || httpVersion.substr(0, 5) != "HTTP/") {
- BOOST_THROW_EXCEPTION(HttpException("HTTP communication error"));
+ NDN_THROW(HttpException("HTTP communication error"));
}
if (statusCode != 200) {
boost::trim(statusMessage);
- BOOST_THROW_EXCEPTION(HttpException("HTTP request failed: " + to_string(statusCode) + " " + statusMessage));
+ NDN_THROW(HttpException("HTTP request failed: " + to_string(statusCode) + " " + statusMessage));
}
std::string header;
while (std::getline(requestStream, header) && header != "\r")
@@ -200,7 +200,7 @@
std::string hubHost;
requestStream >> hubHost;
if (hubHost.empty()) {
- BOOST_THROW_EXCEPTION(HttpException("NDN-FCH did not return hub host"));
+ NDN_THROW(HttpException("NDN-FCH did not return hub host"));
}
this->provideHubFaceUri("udp://" + hubHost);
diff --git a/tools/ndn-autoconfig/stage.cpp b/tools/ndn-autoconfig/stage.cpp
index 2e1e048..0569b24 100644
--- a/tools/ndn-autoconfig/stage.cpp
+++ b/tools/ndn-autoconfig/stage.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, 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,
@@ -33,7 +33,7 @@
Stage::start()
{
if (m_isInProgress) {
- BOOST_THROW_EXCEPTION(Error("Cannot start a stage when it's in progress"));
+ NDN_THROW(Error("Cannot start a stage when it's in progress"));
}
m_isInProgress = true;