Enhance exception throwing with Boost Exception library
Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4919aa
Refs: #2541
diff --git a/rib/fib-updater.cpp b/rib/fib-updater.cpp
index 8d581be..91d1bdd 100644
--- a/rib/fib-updater.cpp
+++ b/rib/fib-updater.cpp
@@ -305,7 +305,8 @@
}
}
else {
- throw Error("Non-recoverable error: " + error + " code: " + std::to_string(code));
+ BOOST_THROW_EXCEPTION(Error("Non-recoverable error: " + error + " code: " +
+ std::to_string(code)));
}
}
diff --git a/rib/nrd.cpp b/rib/nrd.cpp
index bdfab99..bcee83c 100644
--- a/rib/nrd.cpp
+++ b/rib/nrd.cpp
@@ -143,7 +143,7 @@
return make_shared<ndn::TcpTransport>("localhost", port);
}
else {
- throw Error("No transport is available to communicate with NFD");
+ BOOST_THROW_EXCEPTION(Error("No transport is available to communicate with NFD"));
}
}
diff --git a/rib/remote-registrator.cpp b/rib/remote-registrator.cpp
index aa45269..d33ba1b 100644
--- a/rib/remote-registrator.cpp
+++ b/rib/remote-registrator.cpp
@@ -90,8 +90,8 @@
}
else
{
- throw ConfigFile::Error("Unrecognized option \"" + i.first +
- "\" in \"remote-registrator\" section");
+ BOOST_THROW_EXCEPTION(ConfigFile::Error("Unrecognized option \"" + i.first +
+ "\" in \"remote-registrator\" section"));
}
}
diff --git a/rib/rib-manager.cpp b/rib/rib-manager.cpp
index 4c03f3b..91f0eda 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -167,7 +167,7 @@
m_remoteRegistrator.enable();
}
else {
- throw Error("Unrecognized rib property: " + item.first);
+ BOOST_THROW_EXCEPTION(Error("Unrecognized rib property: " + item.first));
}
}
@@ -571,7 +571,7 @@
void
RibManager::onNrdCommandPrefixAddNextHopError(const Name& name, const std::string& msg)
{
- throw Error("Error in setting interest filter (" + name.toUri() + "): " + msg);
+ BOOST_THROW_EXCEPTION(Error("Error in setting interest filter (" + name.toUri() + "): " + msg));
}
void
@@ -586,7 +586,7 @@
std::ostringstream os;
os << "Couldn't enable local control header "
<< "(code: " << code << ", info: " << reason << ")";
- throw Error(os.str());
+ BOOST_THROW_EXCEPTION(Error(os.str()));
}
void