Enhance exception throwing with Boost Exception library
Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4919aa
Refs: #2541
diff --git a/tests/core/simple-notification.hpp b/tests/core/simple-notification.hpp
index aad86e6..44c0be5 100644
--- a/tests/core/simple-notification.hpp
+++ b/tests/core/simple-notification.hpp
@@ -65,7 +65,7 @@
// error for testing
if (!m_message.empty() && m_message[0] == '\x07')
- throw tlv::Error("0x07 error");
+ BOOST_THROW_EXCEPTION(tlv::Error("0x07 error"));
}
public:
diff --git a/tests/daemon/face/dummy-stream-sender.hpp b/tests/daemon/face/dummy-stream-sender.hpp
index af0e114..7cbb4e2 100644
--- a/tests/daemon/face/dummy-stream-sender.hpp
+++ b/tests/daemon/face/dummy-stream-sender.hpp
@@ -67,7 +67,7 @@
{
if (error)
{
- throw Error("Connection aborted");
+ BOOST_THROW_EXCEPTION(Error("Connection aborted"));
}
// This value may need to be adjusted if some dataset exceeds 100k
@@ -88,7 +88,7 @@
onSendFinished(const boost::system::error_code& error, bool isFinal)
{
if (error) {
- throw Error("Connection aborted");
+ BOOST_THROW_EXCEPTION(Error("Connection aborted"));
}
if (isFinal) {
diff --git a/tests/daemon/mgmt/face-status-publisher-common.hpp b/tests/daemon/mgmt/face-status-publisher-common.hpp
index d785149..882c976 100644
--- a/tests/daemon/mgmt/face-status-publisher-common.hpp
+++ b/tests/daemon/mgmt/face-status-publisher-common.hpp
@@ -82,7 +82,7 @@
}
std::stringstream error;
error << "expected type " << type << " got " << block.type();
- throw tlv::Error(error.str());
+ BOOST_THROW_EXCEPTION(tlv::Error(error.str()));
}
static inline uint64_t
@@ -96,7 +96,7 @@
++i;
return readNonNegativeIntegerType(block, type);
}
- throw tlv::Error("Unexpected end of FaceStatus");
+ BOOST_THROW_EXCEPTION(tlv::Error("Unexpected end of FaceStatus"));
}
class FaceStatusPublisherFixture : public BaseFixture
diff --git a/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp b/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
index cbb7280..9f9150b 100644
--- a/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
+++ b/tests/daemon/mgmt/fib-enumeration-publisher-common.hpp
@@ -51,7 +51,7 @@
}
std::stringstream error;
error << "Expected type " << type << " got " << block.type();
- throw tlv::Error(error.str());
+ BOOST_THROW_EXCEPTION(tlv::Error(error.str()));
}
static inline uint64_t
@@ -68,7 +68,7 @@
std::stringstream error;
error << "Unexpected end of Block while attempting to read type #"
<< type;
- throw tlv::Error(error.str());
+ BOOST_THROW_EXCEPTION(tlv::Error(error.str()));
}
class FibEnumerationPublisherFixture : public BaseFixture
diff --git a/tests/limited-io.cpp b/tests/limited-io.cpp
index 4bfd802..ec62041 100644
--- a/tests/limited-io.cpp
+++ b/tests/limited-io.cpp
@@ -101,7 +101,7 @@
m_reason = EXCEED_OPS;
getGlobalIoService().stop();
if (m_uttf != nullptr) {
- throw StopException();
+ BOOST_THROW_EXCEPTION(StopException());
}
}
}
@@ -112,7 +112,7 @@
m_reason = EXCEED_TIME;
getGlobalIoService().stop();
if (m_uttf != nullptr) {
- throw StopException();
+ BOOST_THROW_EXCEPTION(StopException());
}
}
diff --git a/tests/limited-io.hpp b/tests/limited-io.hpp
index 3e4be61..437335c 100644
--- a/tests/limited-io.hpp
+++ b/tests/limited-io.hpp
@@ -87,7 +87,7 @@
private:
/** \brief an exception to stop IO operation
*/
- class StopException
+ class StopException : public std::exception
{
};