From e7dc77695c89ec7ce4332f4d409898e71598b5d1 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Tue, 22 Dec 2020 20:47:52 -0500 Subject: [PATCH] Replace all uses of BOOST_THROW_EXCEPTION with NDN_THROW Refs: #4834 Change-Id: I99a5c3665735f245e943506893faade3954cae5e --- src/logic.cpp | 10 ++++++---- src/logic.hpp | 7 ------- src/state.cpp | 15 ++++----------- 3 files changed, 10 insertions(+), 22 deletions(-) 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 +#include #include INIT_LOGGER(Logic); @@ -225,11 +226,12 @@ Logic::getSessionName(Name prefix) { 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 @@ Logic::getSeqNo(Name prefix) { 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 -#include -#include -#include -#include -#include - -#include #include 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 +#include 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 State::update(const Name& info, const SeqNo& seq) { @@ -131,11 +125,10 @@ void 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(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 @@ State::wireDecode(const Block& wire) 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")); } } }