Enhance exception throwing with Boost Exception library
Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4962ba
Refs: #2997
diff --git a/src/face.cpp b/src/face.cpp
index 7f3880a..98581b3 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -105,7 +105,7 @@
uri.reset(new util::FaceUri(*transportType));
}
catch (const util::FaceUri::Error& error) {
- throw ConfigFile::Error(error.what());
+ BOOST_THROW_EXCEPTION(ConfigFile::Error(error.what()));
}
const std::string protocol = uri->getScheme();
@@ -117,7 +117,7 @@
construct(TcpTransport::create(config), keyChain);
}
else {
- throw ConfigFile::Error("Unsupported transport protocol \"" + protocol + "\"");
+ BOOST_THROW_EXCEPTION(ConfigFile::Error("Unsupported transport protocol \"" + protocol + "\""));
}
}
@@ -140,7 +140,7 @@
// Use `interestToExpress` to avoid wire format creation for the original Interest
if (interestToExpress->wireEncode().size() > MAX_NDN_PACKET_SIZE)
- throw Error("Interest size exceeds maximum limit");
+ BOOST_THROW_EXCEPTION(Error("Interest size exceeds maximum limit"));
// If the same ioService thread, dispatch directly calls the method
m_ioService.dispatch([=] { m_impl->asyncExpressInterest(interestToExpress, onData, onTimeout); });
@@ -164,7 +164,7 @@
{
// Use original `data`, since wire format should already exist for the original Data
if (data.wireEncode().size() > MAX_NDN_PACKET_SIZE)
- throw Error("Data size exceeds maximum limit");
+ BOOST_THROW_EXCEPTION(Error("Data size exceeds maximum limit"));
shared_ptr<const Data> dataPtr;
try {