Enhance exception throwing with Boost Exception library
Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4919aa
Refs: #2541
diff --git a/daemon/face/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index ece6d0e..c883163 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.cpp
@@ -77,8 +77,8 @@
+ error.message());
if (!error) {
// someone answered, leave the socket alone
- throw Error("Socket file at " + m_endpoint.path()
- + " belongs to another NFD process");
+ BOOST_THROW_EXCEPTION(Error("Socket file at " + m_endpoint.path()
+ + " belongs to another NFD process"));
}
else if (error == boost::asio::error::connection_refused ||
error == boost::asio::error::timed_out) {
@@ -89,7 +89,7 @@
}
}
else if (type != fs::file_not_found) {
- throw Error(m_endpoint.path() + " already exists and is not a socket file");
+ BOOST_THROW_EXCEPTION(Error(m_endpoint.path() + " already exists and is not a socket file"));
}
m_acceptor.open();
@@ -97,7 +97,8 @@
m_acceptor.listen(backlog);
if (::chmod(m_endpoint.path().c_str(), 0666) < 0) {
- throw Error("chmod(" + m_endpoint.path() + ") failed: " + std::strerror(errno));
+ BOOST_THROW_EXCEPTION(Error("chmod(" + m_endpoint.path() + ") failed: " +
+ std::strerror(errno)));
}
// start accepting connections