Replace all uses of BOOST_THROW_EXCEPTION with NDN_THROW
Refs: #4834
Change-Id: I99a5c3665735f245e943506893faade3954cae5e
diff --git a/src/logic.cpp b/src/logic.cpp
index 2701aa5..6d52def 100644
--- a/src/logic.cpp
+++ b/src/logic.cpp
@@ -28,6 +28,7 @@
#include "bzip2-helper.hpp"
#include <ndn-cxx/util/backports.hpp>
+#include <ndn-cxx/util/exception.hpp>
#include <ndn-cxx/util/string-helper.hpp>
INIT_LOGGER(Logic);
@@ -225,11 +226,12 @@
{
if (prefix == EMPTY_NAME)
prefix = m_defaultUserPrefix;
+
auto node = m_nodeList.find(prefix);
if (node != m_nodeList.end())
return node->second.sessionName;
- else
- BOOST_THROW_EXCEPTION(Error("Refer to non-existent node:" + prefix.toUri()));
+
+ NDN_THROW(Error("Nonexistent node: " + prefix.toUri()));
}
const SeqNo&
@@ -237,12 +239,12 @@
{
if (prefix == EMPTY_NAME)
prefix = m_defaultUserPrefix;
+
auto node = m_nodeList.find(prefix);
if (node != m_nodeList.end())
return node->second.seqNo;
- else
- BOOST_THROW_EXCEPTION(Logic::Error("Refer to non-existent node:" + prefix.toUri()));
+ NDN_THROW(Error("Nonexistent node: " + prefix.toUri()));
}
void
diff --git a/src/logic.hpp b/src/logic.hpp
index bd5d3db..e016a9e 100644
--- a/src/logic.hpp
+++ b/src/logic.hpp
@@ -31,13 +31,6 @@
#include <ndn-cxx/util/random.hpp>
-#include <boost/archive/iterators/dataflow_exception.hpp>
-#include <boost/archive/iterators/transform_width.hpp>
-#include <boost/assert.hpp>
-#include <boost/iterator/transform_iterator.hpp>
-#include <boost/throw_exception.hpp>
-
-#include <memory>
#include <unordered_map>
namespace chronosync {
diff --git a/src/state.cpp b/src/state.cpp
index 533a451..2f31b89 100644
--- a/src/state.cpp
+++ b/src/state.cpp
@@ -25,18 +25,12 @@
#include "state.hpp"
#include <boost/range/adaptor/reversed.hpp>
+#include <ndn-cxx/util/exception.hpp>
namespace chronosync {
State::~State() = default;
-/**
- * @brief Add or update leaf to the sync tree
- *
- * @param info session name of the leaf
- * @param seq sequence number of the leaf
- * @return 3-tuple (isInserted, isUpdated, oldSeqNo)
- */
std::tuple<bool, bool, SeqNo>
State::update(const Name& info, const SeqNo& seq)
{
@@ -131,11 +125,10 @@
State::wireDecode(const Block& wire)
{
if (!wire.hasWire())
- BOOST_THROW_EXCEPTION(Error("The supplied block does not contain wire format"));
+ NDN_THROW(Error("The supplied block does not contain wire format"));
if (wire.type() != tlv::SyncReply)
- BOOST_THROW_EXCEPTION(Error("Unexpected TLV type when decoding SyncReply: " +
- boost::lexical_cast<std::string>(m_wire.type())));
+ NDN_THROW(Error("Unexpected TLV type when decoding SyncReply: " + ndn::to_string(wire.type())));
wire.parse();
m_wire = wire;
@@ -151,7 +144,7 @@
if (val != it->elements_end())
update(info, readNonNegativeInteger(*val));
else
- BOOST_THROW_EXCEPTION(Error("No seqNo when decoding SyncReply"));
+ NDN_THROW(Error("No SeqNo when decoding SyncReply"));
}
}
}