Enhance exception throwing with Boost Exception library
Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4962ba
Refs: #2997
diff --git a/src/transport/stream-transport.hpp b/src/transport/stream-transport.hpp
index d7f2e49..99dc510 100644
--- a/src/transport/stream-transport.hpp
+++ b/src/transport/stream-transport.hpp
@@ -68,7 +68,7 @@
// may need to throw exception
m_transport.m_isConnected = false;
m_transport.close();
- throw Transport::Error(error, "error while connecting to the forwarder");
+ BOOST_THROW_EXCEPTION(Transport::Error(error, "error while connecting to the forwarder"));
}
}
@@ -79,7 +79,7 @@
return;
m_transport.close();
- throw Transport::Error(error, "error while connecting to the forwarder");
+ BOOST_THROW_EXCEPTION(Transport::Error(error, "error while connecting to the forwarder"));
}
void
@@ -192,7 +192,7 @@
}
m_transport.close();
- throw Transport::Error(error, "error while sending data to socket");
+ BOOST_THROW_EXCEPTION(Transport::Error(error, "error while sending data to socket"));
}
m_transmissionQueue.erase(queueItem);
@@ -231,7 +231,7 @@
}
m_transport.close();
- throw Transport::Error(error, "error while receiving data from socket");
+ BOOST_THROW_EXCEPTION(Transport::Error(error, "error while receiving data from socket"));
}
m_inputBufferSize += nBytesRecvd;
@@ -242,8 +242,9 @@
if (!hasProcessedSome && m_inputBufferSize == MAX_NDN_PACKET_SIZE && offset == 0)
{
m_transport.close();
- throw Transport::Error(boost::system::error_code(),
- "input buffer full, but a valid TLV cannot be decoded");
+ BOOST_THROW_EXCEPTION(Transport::Error(boost::system::error_code(),
+ "input buffer full, but a valid TLV cannot be "
+ "decoded"));
}
if (offset > 0)
@@ -300,14 +301,14 @@
if (error == boost::system::errc::operation_canceled)
return;
- throw Transport::Error(error, "Error during resolution of host or port");
+ BOOST_THROW_EXCEPTION(Transport::Error(error, "Error during resolution of host or port"));
}
typename Protocol::resolver::iterator end;
if (endpoint == end)
{
this->m_transport.close();
- throw Transport::Error(error, "Unable to resolve because host or port");
+ BOOST_THROW_EXCEPTION(Transport::Error(error, "Unable to resolve because host or port"));
}
this->m_socket.async_connect(*endpoint,