Enhance exception throwing with Boost Exception library
Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4962ba
Refs: #2997
diff --git a/src/lp/detail/field-decl.hpp b/src/lp/detail/field-decl.hpp
index e6fd4aa..0738768 100644
--- a/src/lp/detail/field-decl.hpp
+++ b/src/lp/detail/field-decl.hpp
@@ -44,7 +44,7 @@
decode(const Block& wire)
{
if (wire.type() != TlvType::value) {
- throw ndn::tlv::Error("Unexpected TLV type " + std::to_string(wire.type()));
+ BOOST_THROW_EXCEPTION(ndn::tlv::Error("Unexpected TLV type " + std::to_string(wire.type())));
}
T type;
@@ -60,7 +60,7 @@
decode(const Block& wire)
{
if (wire.type() != TlvType::value) {
- throw ndn::tlv::Error("Unexpected TLV type " + std::to_string(wire.type()));
+ BOOST_THROW_EXCEPTION(ndn::tlv::Error("Unexpected TLV type " + std::to_string(wire.type())));
}
return readNonNegativeInteger(wire);
@@ -74,11 +74,11 @@
decode(const Block& wire)
{
if (wire.type() != TlvType::value) {
- throw ndn::tlv::Error("Unexpected TLV type " + std::to_string(wire.type()));
+ BOOST_THROW_EXCEPTION(ndn::tlv::Error("Unexpected TLV type " + std::to_string(wire.type())));
}
if (wire.value_size() == 0) {
- throw ndn::tlv::Error(std::to_string(wire.type()) + " must not be empty");
+ BOOST_THROW_EXCEPTION(ndn::tlv::Error(std::to_string(wire.type()) + " must not be empty"));
}
return std::make_pair(wire.value_begin(), wire.value_end());
@@ -147,4 +147,4 @@
} // namespace lp
} // namesapce ndn
-#endif // NDN_CXX_LP_DETAIL_FIELD_DECL_HPP
\ No newline at end of file
+#endif // NDN_CXX_LP_DETAIL_FIELD_DECL_HPP