Replace remaining uses of BOOST_THROW_EXCEPTION with NDN_THROW
Change-Id: I0c149acbe5607d928cdf9e8d73813d5e74ca45d0
diff --git a/src/lsa/adj-lsa.cpp b/src/lsa/adj-lsa.cpp
index f3b04da..781422c 100644
--- a/src/lsa/adj-lsa.cpp
+++ b/src/lsa/adj-lsa.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -93,8 +93,7 @@
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::AdjacencyLsa) {
- BOOST_THROW_EXCEPTION(Error("Expected AdjacencyLsa Block, but Block is of a different type: #" +
- ndn::to_string(m_wire.type())));
+ NDN_THROW(Error("AdjacencyLsa", m_wire.type()));
}
m_wire.parse();
@@ -106,18 +105,16 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required Lsa field"));
+ NDN_THROW(Error("Missing required Lsa field"));
}
AdjacencyList adl;
for (; val != m_wire.elements_end(); ++val) {
if (val->type() == ndn::tlv::nlsr::Adjacency) {
- Adjacent adj = Adjacent(*val);
- adl.insert(adj);
+ adl.insert(Adjacent(*val));
}
else {
- BOOST_THROW_EXCEPTION(Error("Expected Adjacency Block, but Block is of a different type: #" +
- ndn::to_string(m_wire.type())));
+ NDN_THROW(Error("Adjacency", val->type()));
}
}
m_adl = adl;
diff --git a/src/lsa/coordinate-lsa.cpp b/src/lsa/coordinate-lsa.cpp
index 4109c64..32172e6 100644
--- a/src/lsa/coordinate-lsa.cpp
+++ b/src/lsa/coordinate-lsa.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -105,10 +105,7 @@
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::CoordinateLsa) {
- std::stringstream error;
- error << "Expected CoordinateLsa Block, but Block is of a different type: #"
- << m_wire.type();
- BOOST_THROW_EXCEPTION(Error(error.str()));
+ NDN_THROW(Error("CoordinateLsa", m_wire.type()));
}
m_wire.parse();
@@ -120,7 +117,7 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required Lsa field"));
+ NDN_THROW(Error("Missing required Lsa field"));
}
if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::HyperbolicRadius) {
@@ -128,7 +125,7 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required HyperbolicRadius field"));
+ NDN_THROW(Error("Missing required HyperbolicRadius field"));
}
std::vector<double> angles;
@@ -137,7 +134,7 @@
angles.push_back(ndn::encoding::readDouble(*val));
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required HyperbolicAngle field"));
+ NDN_THROW(Error("Missing required HyperbolicAngle field"));
}
}
m_hyperbolicAngles = angles;
diff --git a/src/lsa/lsa.cpp b/src/lsa/lsa.cpp
index dd8267e..25841d2 100644
--- a/src/lsa/lsa.cpp
+++ b/src/lsa/lsa.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -73,7 +73,7 @@
m_originRouter.wireDecode(*val);
}
else {
- BOOST_THROW_EXCEPTION(Error("OriginRouter: Missing required Name field"));
+ NDN_THROW(Error("OriginRouter: Missing required Name field"));
}
++val;
@@ -83,14 +83,14 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required SequenceNumber field"));
+ NDN_THROW(Error("Missing required SequenceNumber field"));
}
if (val != baseWire.elements_end() && val->type() == ndn::tlv::nlsr::ExpirationTime) {
m_expirationTimePoint = ndn::time::fromString(readString(*val));
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required ExpirationTimePoint field"));
+ NDN_THROW(Error("Missing required ExpirationTime field"));
}
}
diff --git a/src/lsa/lsa.hpp b/src/lsa/lsa.hpp
index a44a594..7fb1058 100644
--- a/src/lsa/lsa.hpp
+++ b/src/lsa/lsa.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -28,7 +28,6 @@
#include "test-access-control.hpp"
#include <ndn-cxx/util/scheduler.hpp>
-#include <ndn-cxx/util/time.hpp>
namespace nlsr {
@@ -45,11 +44,7 @@
class Error : public ndn::tlv::Error
{
public:
- explicit
- Error(const std::string& what)
- : ndn::tlv::Error(what)
- {
- }
+ using ndn::tlv::Error::Error;
};
enum class Type {
diff --git a/src/lsa/name-lsa.cpp b/src/lsa/name-lsa.cpp
index cfdfd77..173b9c7 100644
--- a/src/lsa/name-lsa.cpp
+++ b/src/lsa/name-lsa.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -85,8 +85,7 @@
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::NameLsa) {
- BOOST_THROW_EXCEPTION(Error("Expected NameLsa Block, but Block is of a different type: #" +
- ndn::to_string(m_wire.type())));
+ NDN_THROW(Error("NameLsa", m_wire.type()));
}
m_wire.parse();
@@ -98,7 +97,7 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required Lsa field"));
+ NDN_THROW(Error("Missing required Lsa field"));
}
NamePrefixList npl;
@@ -107,11 +106,9 @@
npl.insert(ndn::Name(*val));
}
else {
- BOOST_THROW_EXCEPTION(Error("Expected Name Block, but Block is of a different type: #" +
- ndn::to_string(m_wire.type())));
+ NDN_THROW(Error("Name", val->type()));
}
}
-
m_npl = npl;
}