diff --git a/src/common.hpp b/src/common.hpp
index a4f61e3..123fb8a 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -131,6 +131,7 @@
 #include <boost/assert.hpp>
 #include <boost/concept_check.hpp>
 #include <boost/noncopyable.hpp>
+#include <boost/throw_exception.hpp>
 
 namespace ndn {
 using boost::noncopyable;
diff --git a/src/data.cpp b/src/data.cpp
index 9e5effe..f96fb8f 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -63,7 +63,7 @@
 
   if (!unsignedPortion && !m_signature)
     {
-      throw Error("Requested wire format, but data packet has not been signed yet");
+      BOOST_THROW_EXCEPTION(Error("Requested wire format, but data packet has not been signed yet"));
     }
 
   if (!unsignedPortion)
@@ -180,8 +180,8 @@
 {
   if (m_fullName.empty()) {
     if (!m_wire.hasWire()) {
-      throw Error("Full name requested, but Data packet does not have wire format "
-                  "(e.g., not signed)");
+      BOOST_THROW_EXCEPTION(Error("Full name requested, but Data packet does not have wire format "
+                                  "(e.g., not signed)"));
     }
     m_fullName = m_name;
     m_fullName.appendImplicitSha256Digest(crypto::sha256(m_wire.wire(), m_wire.size()));
diff --git a/src/encoding/block.cpp b/src/encoding/block.cpp
index 77be4f2..624439d 100644
--- a/src/encoding/block.cpp
+++ b/src/encoding/block.cpp
@@ -63,7 +63,7 @@
   uint64_t length = tlv::readVarNumber(m_value_begin, m_value_end);
   if (length != static_cast<uint64_t>(m_value_end - m_value_begin))
     {
-      throw tlv::Error("TLV length doesn't match buffer length");
+      BOOST_THROW_EXCEPTION(tlv::Error("TLV length doesn't match buffer length"));
     }
 }
 
@@ -95,7 +95,7 @@
   uint64_t length = tlv::readVarNumber(m_value_begin, m_value_end);
   if (length != static_cast<uint64_t>(m_value_end - m_value_begin))
     {
-      throw tlv::Error("TLV length doesn't match buffer length");
+      BOOST_THROW_EXCEPTION(tlv::Error("TLV length doesn't match buffer length"));
     }
 }
 
@@ -116,7 +116,7 @@
     {
       if (length != static_cast<uint64_t>(m_value_end - m_value_begin))
         {
-          throw tlv::Error("TLV length doesn't match buffer length");
+          BOOST_THROW_EXCEPTION(tlv::Error("TLV length doesn't match buffer length"));
         }
     }
 }
@@ -131,7 +131,7 @@
 
   if (length > static_cast<uint64_t>(tmp_end - tmp_begin))
     {
-      throw tlv::Error("Not enough data in the buffer to fully parse TLV");
+      BOOST_THROW_EXCEPTION(tlv::Error("Not enough data in the buffer to fully parse TLV"));
     }
 
   m_buffer = make_shared<Buffer>(buffer, (tmp_begin - buffer) + length);
@@ -156,7 +156,7 @@
 
   if (length > static_cast<uint64_t>(tmp_end - tmp_begin))
     {
-      throw tlv::Error("Not enough data in the buffer to fully parse TLV");
+      BOOST_THROW_EXCEPTION(tlv::Error("Not enough data in the buffer to fully parse TLV"));
     }
 
   m_buffer = make_shared<Buffer>(buffer, (tmp_begin - buffer) + length);
@@ -210,7 +210,7 @@
   }
 
   if (length > MAX_SIZE_OF_BLOCK_FROM_STREAM)
-    throw tlv::Error("Length of block from stream is too large");
+    BOOST_THROW_EXCEPTION(tlv::Error("Length of block from stream is too large"));
 
   // We may still have some problem here, if some exception happens,
   // we may completely lose all the bytes extracted from the stream.
@@ -220,7 +220,7 @@
   is.read(buf + 1, length - 1);
 
   if (length != static_cast<uint64_t>(is.gcount()) + 1) {
-    throw tlv::Error("Not enough data in the buffer to fully parse TLV");
+    BOOST_THROW_EXCEPTION(tlv::Error("Not enough data in the buffer to fully parse TLV"));
   }
 
   return makeBinaryBlock(type, buf, length);
@@ -314,7 +314,7 @@
       if (length > static_cast<uint64_t>(end - begin))
         {
           m_subBlocks.clear();
-          throw tlv::Error("TLV length exceeds buffer length");
+          BOOST_THROW_EXCEPTION(tlv::Error("TLV length exceeds buffer length"));
         }
       Buffer::const_iterator element_end = begin + length;
 
@@ -364,7 +364,7 @@
           os.write(reinterpret_cast<const char*>(i->value()), i->value_size());
         }
         else
-          throw Error("Underlying value buffer is empty");
+          BOOST_THROW_EXCEPTION(Error("Underlying value buffer is empty"));
       }
     }
 
@@ -389,8 +389,8 @@
   if (it != m_subBlocks.end())
     return *it;
 
-  throw Error("(Block::get) Requested a non-existed type [" +
-              boost::lexical_cast<std::string>(type) + "] from Block");
+  BOOST_THROW_EXCEPTION(Error("(Block::get) Requested a non-existed type [" +
+                              boost::lexical_cast<std::string>(type) + "] from Block"));
 }
 
 Block::element_const_iterator
@@ -414,7 +414,7 @@
 Block::blockFromValue() const
 {
   if (value_size() == 0)
-    throw Error("Underlying value buffer is empty");
+    BOOST_THROW_EXCEPTION(Error("Underlying value buffer is empty"));
 
   Buffer::const_iterator begin = value_begin(),
                          end = value_end();
@@ -425,7 +425,7 @@
   uint64_t length = tlv::readVarNumber(begin, end);
 
   if (length != static_cast<uint64_t>(end - begin))
-    throw tlv::Error("TLV length mismatches buffer length");
+    BOOST_THROW_EXCEPTION(tlv::Error("TLV length mismatches buffer length"));
 
   return Block(m_buffer,
                type,
@@ -454,7 +454,7 @@
 Block::begin() const
 {
   if (!hasWire())
-    throw Error("Underlying wire buffer is empty");
+    BOOST_THROW_EXCEPTION(Error("Underlying wire buffer is empty"));
 
   return m_begin;
 }
@@ -463,7 +463,7 @@
 Block::end() const
 {
   if (!hasWire())
-    throw Error("Underlying wire buffer is empty");
+    BOOST_THROW_EXCEPTION(Error("Underlying wire buffer is empty"));
 
   return m_end;
 }
@@ -472,7 +472,7 @@
 Block::wire() const
 {
   if (!hasWire())
-    throw Error("(Block::wire) Underlying wire buffer is empty");
+    BOOST_THROW_EXCEPTION(Error("(Block::wire) Underlying wire buffer is empty"));
 
   return &*m_begin;
 }
@@ -484,7 +484,7 @@
     return m_size;
   }
   else
-    throw Error("Block size cannot be determined (undefined block size)");
+    BOOST_THROW_EXCEPTION(Error("Block size cannot be determined (undefined block size)"));
 }
 
 bool
diff --git a/src/encoding/tlv.hpp b/src/encoding/tlv.hpp
index 7d7461f..b1223e8 100644
--- a/src/encoding/tlv.hpp
+++ b/src/encoding/tlv.hpp
@@ -303,12 +303,12 @@
 readVarNumber(InputIterator& begin, const InputIterator& end)
 {
   if (begin == end)
-    throw Error("Empty buffer during TLV processing");
+    BOOST_THROW_EXCEPTION(Error("Empty buffer during TLV processing"));
 
   uint64_t value;
   bool isOk = readVarNumber(begin, end, value);
   if (!isOk)
-    throw Error("Insufficient data during TLV processing");
+    BOOST_THROW_EXCEPTION(Error("Insufficient data during TLV processing"));
 
   return value;
 }
@@ -378,7 +378,7 @@
   uint64_t type = readVarNumber(begin, end);
   if (type > std::numeric_limits<uint32_t>::max())
     {
-      throw Error("TLV type code exceeds allowed maximum");
+      BOOST_THROW_EXCEPTION(Error("TLV type code exceeds allowed maximum"));
     }
 
   return static_cast<uint32_t>(type);
@@ -436,7 +436,7 @@
   case 1:
     {
       if (end - begin < 1)
-        throw Error("Insufficient data during TLV processing");
+        BOOST_THROW_EXCEPTION(Error("Insufficient data during TLV processing"));
 
       uint8_t value = *begin;
       begin++;
@@ -445,7 +445,7 @@
   case 2:
     {
       if (end - begin < 2)
-        throw Error("Insufficient data during TLV processing");
+        BOOST_THROW_EXCEPTION(Error("Insufficient data during TLV processing"));
 
       uint16_t value = *reinterpret_cast<const uint16_t*>(&*begin);
       begin += 2;
@@ -454,7 +454,7 @@
   case 4:
     {
       if (end - begin < 4)
-        throw Error("Insufficient data during TLV processing");
+        BOOST_THROW_EXCEPTION(Error("Insufficient data during TLV processing"));
 
       uint32_t value = *reinterpret_cast<const uint32_t*>(&*begin);
       begin += 4;
@@ -463,14 +463,14 @@
   case 8:
     {
       if (end - begin < 8)
-        throw Error("Insufficient data during TLV processing");
+        BOOST_THROW_EXCEPTION(Error("Insufficient data during TLV processing"));
 
       uint64_t value = *reinterpret_cast<const uint64_t*>(&*begin);
       begin += 8;
       return be64toh(value);
     }
   }
-  throw Error("Invalid length for nonNegativeInteger (only 1, 2, 4, and 8 are allowed)");
+  BOOST_THROW_EXCEPTION(Error("Invalid length for nonNegativeInteger (only 1, 2, 4, and 8 are allowed)"));
 }
 
 template<>
@@ -483,7 +483,7 @@
   case 1:
     {
       if (begin == end)
-        throw Error("Insufficient data during TLV processing");
+        BOOST_THROW_EXCEPTION(Error("Insufficient data during TLV processing"));
 
       uint64_t value = *begin;
       begin++;
@@ -500,7 +500,7 @@
         }
 
       if (count != 2)
-        throw Error("Insufficient data during TLV processing");
+        BOOST_THROW_EXCEPTION(Error("Insufficient data during TLV processing"));
 
       return value;
     }
@@ -515,7 +515,7 @@
         }
 
       if (count != 4)
-        throw Error("Insufficient data during TLV processing");
+        BOOST_THROW_EXCEPTION(Error("Insufficient data during TLV processing"));
 
       return value;
     }
@@ -530,12 +530,12 @@
         }
 
       if (count != 8)
-        throw Error("Insufficient data during TLV processing");
+        BOOST_THROW_EXCEPTION(Error("Insufficient data during TLV processing"));
 
       return value;
     }
   }
-  throw Error("Invalid length for nonNegativeInteger (only 1, 2, 4, and 8 are allowed)");
+  BOOST_THROW_EXCEPTION(Error("Invalid length for nonNegativeInteger (only 1, 2, 4, and 8 are allowed)"));
 }
 
 inline size_t
diff --git a/src/exclude.cpp b/src/exclude.cpp
index b5482cd..bd4d4d7 100644
--- a/src/exclude.cpp
+++ b/src/exclude.cpp
@@ -49,7 +49,7 @@
 Exclude::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   if (m_exclude.empty()) {
-    throw Error("Exclude filter cannot be empty");
+    BOOST_THROW_EXCEPTION(Error("Exclude filter cannot be empty"));
   }
 
   size_t totalLength = 0;
@@ -99,13 +99,13 @@
   clear();
 
   if (wire.type() != tlv::Exclude)
-    throw tlv::Error("Unexpected TLV type when decoding Exclude");
+    BOOST_THROW_EXCEPTION(tlv::Error("Unexpected TLV type when decoding Exclude"));
 
   m_wire = wire;
   m_wire.parse();
 
   if (m_wire.elements_size() == 0) {
-    throw Error("Exclude element cannot be empty");
+    BOOST_THROW_EXCEPTION(Error("Exclude element cannot be empty"));
   }
 
   // Exclude ::= EXCLUDE-TYPE TLV-LENGTH Any? (NameComponent (Any)?)+
@@ -123,7 +123,7 @@
       excludedComponent = std::move(name::Component(*i));
     }
     catch (const name::Component::Error&) {
-      throw Error("Incorrect format of Exclude filter");
+      BOOST_THROW_EXCEPTION(Error("Incorrect format of Exclude filter"));
     }
 
     ++i;
@@ -209,8 +209,8 @@
 Exclude::excludeRange(const name::Component& from, const name::Component& to)
 {
   if (from >= to) {
-    throw Error("Invalid exclude range [" + from.toUri() + ", " + to.toUri() + "] "
-                "(for single name exclude use Exclude::excludeOne)");
+    BOOST_THROW_EXCEPTION(Error("Invalid exclude range [" + from.toUri() + ", " + to.toUri() + "] "
+                                "(for single name exclude use Exclude::excludeOne)"));
   }
 
   iterator newFrom = m_exclude.lower_bound(from);
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 {
diff --git a/src/interest-filter.hpp b/src/interest-filter.hpp
index 6207e18..68cb7d5 100644
--- a/src/interest-filter.hpp
+++ b/src/interest-filter.hpp
@@ -94,8 +94,8 @@
   operator const Name&() const
   {
     if (static_cast<bool>(m_regexFilter)) {
-      throw Error("Please update OnInterest callback to accept const InterestFilter& "
-                  "(non-trivial Interest filter is being used)");
+      BOOST_THROW_EXCEPTION(Error("Please update OnInterest callback to accept const "
+                                  "InterestFilter& (non-trivial Interest filter is being used)"));
     }
     return m_prefix;
   }
diff --git a/src/interest.cpp b/src/interest.cpp
index 4873f39..d4ce90b 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -306,7 +306,7 @@
   //                SelectedDelegation?
 
   if (m_wire.type() != tlv::Interest)
-    throw Error("Unexpected TLV number when decoding Interest");
+    BOOST_THROW_EXCEPTION(Error("Unexpected TLV number when decoding Interest"));
 
   // Name
   m_name.wireDecode(m_wire.get(tlv::Name));
@@ -345,14 +345,14 @@
   val = m_wire.find(tlv::SelectedDelegation);
   if (val != m_wire.elements_end()) {
     if (!this->hasLink()) {
-      throw Error("Interest contains selectedDelegation, but no LINK object");
+      BOOST_THROW_EXCEPTION(Error("Interest contains selectedDelegation, but no LINK object"));
     }
     uint64_t selectedDelegation = readNonNegativeInteger(*val);
     if (selectedDelegation < uint64_t(Link::countDelegationsFromWire(m_link))) {
       m_selectedDelegationIndex = static_cast<size_t>(selectedDelegation);
     }
     else {
-      throw Error("Invalid selected delegation index when decoding Interest");
+      BOOST_THROW_EXCEPTION(Error("Invalid selected delegation index when decoding Interest"));
     }
   }
 }
@@ -372,7 +372,7 @@
     {
       return Link(m_link);
     }
-  throw Error("There is no encapsulated link object");
+  BOOST_THROW_EXCEPTION(Error("There is no encapsulated link object"));
 }
 
 void
@@ -380,7 +380,7 @@
 {
   m_link = link;
   if (!link.hasWire()) {
-    throw Error("The given link does not have a wire format");
+    BOOST_THROW_EXCEPTION(Error("The given link does not have a wire format"));
   }
   m_wire.reset();
   this->unsetSelectedDelegation();
@@ -408,7 +408,7 @@
 Interest::getSelectedDelegation() const
 {
   if (!hasSelectedDelegation()) {
-    throw Error("There is no encapsulated selected delegation");
+    BOOST_THROW_EXCEPTION(Error("There is no encapsulated selected delegation"));
   }
   return std::get<1>(Link::getDelegationFromWire(m_link, m_selectedDelegationIndex));
 }
@@ -421,7 +421,7 @@
     m_selectedDelegationIndex = delegationIndex;
   }
   else {
-    throw std::invalid_argument("Invalid selected delegation name");
+    BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid selected delegation name"));
   }
   m_wire.reset();
 }
@@ -430,7 +430,7 @@
 Interest::setSelectedDelegation(size_t delegationIndex)
 {
   if (delegationIndex >= Link(m_link).getDelegations().size()) {
-    throw Error("Invalid selected delegation index");
+    BOOST_THROW_EXCEPTION(Error("Invalid selected delegation index"));
   }
   m_selectedDelegationIndex = delegationIndex;
   m_wire.reset();
diff --git a/src/key-locator.cpp b/src/key-locator.cpp
index 2f92d5d..151a704 100644
--- a/src/key-locator.cpp
+++ b/src/key-locator.cpp
@@ -65,7 +65,7 @@
     totalLength += encoder.prependBlock(m_keyDigest);
     break;
   default:
-    throw Error("Unsupported KeyLocator type");
+    BOOST_THROW_EXCEPTION(Error("Unsupported KeyLocator type"));
   }
 
   totalLength += encoder.prependVarNumber(totalLength);
@@ -99,7 +99,7 @@
 KeyLocator::wireDecode(const Block& wire)
 {
   if (wire.type() != tlv::KeyLocator)
-    throw Error("Unexpected TLV type during KeyLocator decoding");
+    BOOST_THROW_EXCEPTION(Error("Unexpected TLV type during KeyLocator decoding"));
 
   m_wire = wire;
   m_wire.parse();
@@ -138,7 +138,7 @@
 KeyLocator::getName() const
 {
   if (m_type != KeyLocator_Name)
-    throw Error("KeyLocator type is not Name");
+    BOOST_THROW_EXCEPTION(Error("KeyLocator type is not Name"));
 
   return m_name;
 }
@@ -156,7 +156,7 @@
 KeyLocator::getKeyDigest() const
 {
   if (m_type != KeyLocator_KeyDigest)
-    throw Error("KeyLocator type is not KeyDigest");
+    BOOST_THROW_EXCEPTION(Error("KeyLocator type is not KeyDigest"));
 
   return m_keyDigest;
 }
@@ -165,7 +165,7 @@
 KeyLocator::setKeyDigest(const Block& keyDigest)
 {
   if (keyDigest.type() != tlv::KeyDigest)
-    throw Error("expecting KeyDigest block");
+    BOOST_THROW_EXCEPTION(Error("expecting KeyDigest block"));
 
   this->clear();
   m_type = KeyLocator_KeyDigest;
diff --git a/src/link.cpp b/src/link.cpp
index b900450..d4de993 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -144,7 +144,7 @@
 
   if (getContentType() != tlv::ContentType_Link)
     {
-      throw Error("Expected Content Type Link");
+      BOOST_THROW_EXCEPTION(Error("Expected Content Type Link"));
     }
 
   const Block& content = getContent();
@@ -154,18 +154,18 @@
     delegation.parse();
     Block::element_const_iterator val = delegation.elements_begin();
     if (val == delegation.elements_end()) {
-      throw Error("Unexpected Link Encoding");
+      BOOST_THROW_EXCEPTION(Error("Unexpected Link Encoding"));
     }
     uint32_t preference;
     try {
       preference = static_cast<uint32_t>(readNonNegativeInteger(*val));
     }
     catch (tlv::Error&) {
-      throw Error("Missing preference field in Link Encoding");
+      BOOST_THROW_EXCEPTION(Error("Missing preference field in Link Encoding"));
     }
     ++val;
     if (val == delegation.elements_end()) {
-      throw Error("Missing name field in Link Encoding");
+      BOOST_THROW_EXCEPTION(Error("Missing name field in Link Encoding"));
     }
     Name name(*val);
     m_delegations.insert({preference, name});
@@ -188,7 +188,7 @@
   const Block& delegationBlock = contentBlock.elements().at(index);
   delegationBlock.parse();
   if (delegationBlock.type() != tlv::LinkDelegation) {
-    throw Error("Unexpected TLV-TYPE; expecting LinkDelegation");
+    BOOST_THROW_EXCEPTION(Error("Unexpected TLV-TYPE, expecting LinkDelegation"));
   }
   return std::make_tuple(
     static_cast<uint32_t>(
@@ -206,7 +206,7 @@
   for (auto&& delegationBlock : contentBlock.elements()) {
     delegationBlock.parse();
     if (delegationBlock.type() != tlv::LinkDelegation) {
-      throw Error("Unexpected TLV-TYPE; expecting LinkDelegation");
+      BOOST_THROW_EXCEPTION(Error("Unexpected TLV-TYPE, expecting LinkDelegation"));
     }
     Name name(delegationBlock.get(tlv::Name));
     if (name == delegationName) {
diff --git a/src/lp/cache-policy.cpp b/src/lp/cache-policy.cpp
index 6bd1be9..2802b96 100644
--- a/src/lp/cache-policy.cpp
+++ b/src/lp/cache-policy.cpp
@@ -56,7 +56,7 @@
 CachePolicy::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   if (m_policy == CachePolicyType::NONE) {
-    throw Error("CachePolicyType must be set");
+    BOOST_THROW_EXCEPTION(Error("CachePolicyType must be set"));
   }
   size_t length = 0;
   length += prependNonNegativeIntegerBlock(encoder, tlv::CachePolicyType,
@@ -76,7 +76,7 @@
 CachePolicy::wireEncode() const
 {
   if (m_policy == CachePolicyType::NONE) {
-    throw Error("CachePolicyType must be set");
+    BOOST_THROW_EXCEPTION(Error("CachePolicyType must be set"));
   }
 
   if (m_wire.hasWire()) {
@@ -98,7 +98,7 @@
 CachePolicy::wireDecode(const Block& wire)
 {
   if (wire.type() != tlv::CachePolicy) {
-    throw Error("expecting CachePolicy block");
+    BOOST_THROW_EXCEPTION(Error("expecting CachePolicy block"));
   }
 
   m_wire = wire;
@@ -108,11 +108,11 @@
   if (it != m_wire.elements_end() && it->type() == tlv::CachePolicyType) {
     m_policy = static_cast<CachePolicyType>(readNonNegativeInteger(*it));
     if (this->getPolicy() == CachePolicyType::NONE) {
-      throw Error("unknown CachePolicyType");
+      BOOST_THROW_EXCEPTION(Error("unknown CachePolicyType"));
     }
   }
   else {
-    throw Error("expecting CachePolicyType block");
+    BOOST_THROW_EXCEPTION(Error("expecting CachePolicyType block"));
   }
 }
 
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
diff --git a/src/lp/nack-header.cpp b/src/lp/nack-header.cpp
index 22fccae..9f3157c 100644
--- a/src/lp/nack-header.cpp
+++ b/src/lp/nack-header.cpp
@@ -96,7 +96,7 @@
 NackHeader::wireDecode(const Block& wire)
 {
   if (wire.type() != tlv::Nack) {
-    throw ndn::tlv::Error("expecting Nack block");
+    BOOST_THROW_EXCEPTION(ndn::tlv::Error("expecting Nack block"));
   }
 
   m_wire = wire;
@@ -110,7 +110,7 @@
       m_reason = static_cast<NackReason>(readNonNegativeInteger(*it));
     }
     else {
-      throw ndn::tlv::Error("expecting NackReason block");
+      BOOST_THROW_EXCEPTION(ndn::tlv::Error("expecting NackReason block"));
     }
   }
 }
diff --git a/src/lp/packet.cpp b/src/lp/packet.cpp
index 20de690..67957af 100644
--- a/src/lp/packet.cpp
+++ b/src/lp/packet.cpp
@@ -97,16 +97,16 @@
     detail::FieldInfo info(element.type());
 
     if (!info.isRecognized && !info.canIgnore) {
-      throw Error("unknown field cannot be ignored");
+      BOOST_THROW_EXCEPTION(Error("unknown field cannot be ignored"));
     }
 
     if (!isFirst) {
       if (info.tlvType == prev.tlvType && !info.isRepeatable) {
-        throw Error("non-repeatable field cannot be repeated");
+        BOOST_THROW_EXCEPTION(Error("non-repeatable field cannot be repeated"));
       }
 
       else if (info.tlvType != prev.tlvType && !detail::compareFieldSortOrder(prev, info)) {
-        throw Error("fields are not in correct sort order");
+        BOOST_THROW_EXCEPTION(Error("fields are not in correct sort order"));
       }
     }
 
@@ -126,4 +126,4 @@
 }
 
 } // namespace lp
-} // namespace ndn
\ No newline at end of file
+} // namespace ndn
diff --git a/src/lp/packet.hpp b/src/lp/packet.hpp
index bf0cb01..0febb75 100644
--- a/src/lp/packet.hpp
+++ b/src/lp/packet.hpp
@@ -110,7 +110,7 @@
       }
     }
 
-    throw std::out_of_range("Index out of range");
+    BOOST_THROW_EXCEPTION(std::out_of_range("Index out of range"));
   }
 
   /**
@@ -155,7 +155,7 @@
   add(const typename FIELD::ValueType& value)
   {
     if (!FIELD::IsRepeatable::value && has<FIELD>()) {
-      throw std::length_error("Field cannot be repeated");
+      BOOST_THROW_EXCEPTION(std::length_error("Field cannot be repeated"));
     }
 
     EncodingEstimator estimator;
@@ -195,7 +195,7 @@
       }
     }
 
-    throw std::out_of_range("Index out of range");
+    BOOST_THROW_EXCEPTION(std::out_of_range("Index out of range"));
   }
 
   /**
@@ -221,4 +221,4 @@
 } // namespace lp
 } // namespace ndn
 
-#endif // NDN_CXX_LP_PACKET_HPP
\ No newline at end of file
+#endif // NDN_CXX_LP_PACKET_HPP
diff --git a/src/management/nfd-channel-status.cpp b/src/management/nfd-channel-status.cpp
index 2c93283..b53d198 100644
--- a/src/management/nfd-channel-status.cpp
+++ b/src/management/nfd-channel-status.cpp
@@ -82,7 +82,7 @@
 ChannelStatus::wireDecode(const Block& block)
 {
   if (block.type() != tlv::nfd::ChannelStatus) {
-    throw Error("expecting ChannelStatus block");
+    BOOST_THROW_EXCEPTION(Error("Expecting ChannelStatus block"));
   }
   m_wire = block;
   m_wire.parse();
@@ -93,7 +93,7 @@
     ++val;
   }
   else {
-    throw Error("missing required LocalUri field");
+    BOOST_THROW_EXCEPTION(Error("Missing required LocalUri field"));
   }
 }
 
diff --git a/src/management/nfd-command-options.cpp b/src/management/nfd-command-options.cpp
index 72326c9..8a2b9f7 100644
--- a/src/management/nfd-command-options.cpp
+++ b/src/management/nfd-command-options.cpp
@@ -42,7 +42,7 @@
 CommandOptions::setTimeout(const time::milliseconds& timeout)
 {
   if (timeout <= time::milliseconds::zero()) {
-    throw std::out_of_range("timeout must be positive");
+    BOOST_THROW_EXCEPTION(std::out_of_range("Timeout must be positive"));
   }
 
   m_timeout = timeout;
@@ -76,7 +76,8 @@
   case security::SigningInfo::SIGNER_TYPE_CERT:
     return SIGNING_PARAMS_CERTIFICATE;
   default:
-    throw std::out_of_range("SigningInfo::SignerType is not convertible to CommandOptions::SigningParamsKind");
+    BOOST_THROW_EXCEPTION(std::out_of_range("SigningInfo::SignerType is not convertible to "
+                                            "CommandOptions::SigningParamsKind"));
   }
 }
 
@@ -114,7 +115,7 @@
   // A valid IdentityCertificate has at least 4 name components,
   // as it follows `<...>/KEY/<...>/<key-id>/ID-CERT/<version>` naming model.
   if (certificateName.size() < 4) {
-    throw std::invalid_argument("certificate is invalid");
+    BOOST_THROW_EXCEPTION(std::invalid_argument("Certificate is invalid"));
   }
 
   return security::signingByCertificate(certificateName);
diff --git a/src/management/nfd-control-command.cpp b/src/management/nfd-control-command.cpp
index 3c87d3f..d8ab2c6 100644
--- a/src/management/nfd-control-command.cpp
+++ b/src/management/nfd-control-command.cpp
@@ -80,11 +80,13 @@
     bool isPresent = presentFields[i];
     if (m_required[i]) {
       if (!isPresent) {
-        throw ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is required but missing");
+        BOOST_THROW_EXCEPTION(ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is required but "
+                                            "missing"));
       }
     }
     else if (isPresent && !m_optional[i]) {
-      throw ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is forbidden but present");
+      BOOST_THROW_EXCEPTION(ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is forbidden but "
+                                          "present"));
     }
   }
 }
@@ -105,7 +107,7 @@
   this->ControlCommand::validateResponse(parameters);
 
   if (parameters.getFaceId() == 0) {
-    throw ArgumentError("FaceId must not be zero");
+    BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
   }
 }
 
@@ -123,7 +125,7 @@
   this->ControlCommand::validateRequest(parameters);
 
   if (parameters.getFaceId() == 0) {
-    throw ArgumentError("FaceId must not be zero");
+    BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
   }
 }
 
@@ -151,7 +153,7 @@
     case LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID:
       break;
     default:
-      throw ArgumentError("LocalControlFeature is invalid");
+      BOOST_THROW_EXCEPTION(ArgumentError("LocalControlFeature is invalid"));
   }
 }
 
@@ -201,7 +203,7 @@
   this->ControlCommand::validateResponse(parameters);
 
   if (parameters.getFaceId() == 0) {
-    throw ArgumentError("FaceId must not be zero");
+    BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
   }
 }
 
@@ -230,7 +232,7 @@
   this->ControlCommand::validateResponse(parameters);
 
   if (parameters.getFaceId() == 0) {
-    throw ArgumentError("FaceId must not be zero");
+    BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
   }
 }
 
@@ -257,7 +259,7 @@
   this->ControlCommand::validateRequest(parameters);
 
   if (parameters.getName().size() == 0) {
-    throw ArgumentError("Name must not be ndn:/");
+    BOOST_THROW_EXCEPTION(ArgumentError("Name must not be ndn:/"));
   }
 }
 
@@ -309,7 +311,7 @@
   this->ControlCommand::validateResponse(parameters);
 
   if (parameters.getFaceId() == 0) {
-    throw ArgumentError("FaceId must not be zero");
+    BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
   }
 }
 
@@ -343,7 +345,7 @@
   this->ControlCommand::validateResponse(parameters);
 
   if (parameters.getFaceId() == 0) {
-    throw ArgumentError("FaceId must not be zero");
+    BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
   }
 }
 
diff --git a/src/management/nfd-control-parameters.cpp b/src/management/nfd-control-parameters.cpp
index eb9fa0f..f8ce363 100644
--- a/src/management/nfd-control-parameters.cpp
+++ b/src/management/nfd-control-parameters.cpp
@@ -115,7 +115,7 @@
 ControlParameters::wireDecode(const Block& block)
 {
   if (block.type() != tlv::nfd::ControlParameters) {
-    throw Error("expecting TLV-TYPE ControlParameters");
+    BOOST_THROW_EXCEPTION(Error("Expecting TLV-TYPE ControlParameters"));
   }
   m_wire = block;
   m_wire.parse();
@@ -168,7 +168,7 @@
   if (this->hasStrategy()) {
     val->parse();
     if (val->elements().empty()) {
-      throw Error("expecting Strategy/Name");
+      BOOST_THROW_EXCEPTION(Error("Expecting Strategy/Name"));
     }
     else {
       m_strategy.wireDecode(*val->elements_begin());
diff --git a/src/management/nfd-control-response.cpp b/src/management/nfd-control-response.cpp
index 0c2166c..7056162 100644
--- a/src/management/nfd-control-response.cpp
+++ b/src/management/nfd-control-response.cpp
@@ -74,13 +74,15 @@
   m_wire.parse();
 
   if (m_wire.type() != tlv::nfd::ControlResponse)
-    throw Error("Requested decoding of ControlResponse, but Block is of different type");
+    BOOST_THROW_EXCEPTION(Error("Requested decoding of ControlResponse, but Block is of different "
+                                "type"));
 
   Block::element_const_iterator val = m_wire.elements_begin();
   if (val == m_wire.elements_end() ||
       val->type() != tlv::nfd::StatusCode)
     {
-      throw Error("Incorrect ControlResponse format (StatusCode missing or not the first item)");
+      BOOST_THROW_EXCEPTION(Error("Incorrect ControlResponse format (StatusCode missing or not the "
+                                  "first item)"));
     }
 
   m_code = readNonNegativeInteger(*val);
@@ -89,7 +91,8 @@
   if (val == m_wire.elements_end() ||
       val->type() != tlv::nfd::StatusText)
     {
-      throw Error("Incorrect ControlResponse format (StatusText missing or not the second item)");
+      BOOST_THROW_EXCEPTION(Error("Incorrect ControlResponse format (StatusText missing or not the "
+                                  "second item)"));
     }
   m_text.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
   ++val;
diff --git a/src/management/nfd-face-event-notification.cpp b/src/management/nfd-face-event-notification.cpp
index 9e757a3..5f80fe8 100644
--- a/src/management/nfd-face-event-notification.cpp
+++ b/src/management/nfd-face-event-notification.cpp
@@ -89,7 +89,7 @@
 FaceEventNotification::wireDecode(const Block& block)
 {
   if (block.type() != tlv::nfd::FaceEventNotification) {
-    throw Error("expecting FaceEventNotification block");
+    BOOST_THROW_EXCEPTION(Error("expecting FaceEventNotification block"));
   }
   m_wire = block;
   m_wire.parse();
@@ -100,7 +100,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FaceEventKind field");
+    BOOST_THROW_EXCEPTION(Error("missing required FaceEventKind field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceId) {
@@ -108,7 +108,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FaceId field");
+    BOOST_THROW_EXCEPTION(Error("missing required FaceId field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Uri) {
@@ -116,7 +116,7 @@
     ++val;
   }
   else {
-    throw Error("missing required Uri field");
+    BOOST_THROW_EXCEPTION(Error("missing required Uri field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::LocalUri) {
@@ -124,7 +124,7 @@
     ++val;
   }
   else {
-    throw Error("missing required LocalUri field");
+    BOOST_THROW_EXCEPTION(Error("missing required LocalUri field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceScope) {
@@ -132,7 +132,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FaceScope field");
+    BOOST_THROW_EXCEPTION(Error("missing required FaceScope field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::FacePersistency) {
@@ -140,7 +140,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FacePersistency field");
+    BOOST_THROW_EXCEPTION(Error("missing required FacePersistency field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::LinkType) {
@@ -148,7 +148,7 @@
     ++val;
   }
   else {
-    throw Error("missing required LinkType field");
+    BOOST_THROW_EXCEPTION(Error("missing required LinkType field"));
   }
 }
 
diff --git a/src/management/nfd-face-query-filter.cpp b/src/management/nfd-face-query-filter.cpp
index 0fa02f2..bd10d2b 100644
--- a/src/management/nfd-face-query-filter.cpp
+++ b/src/management/nfd-face-query-filter.cpp
@@ -122,7 +122,7 @@
 {
   //all fields are optional
   if (block.type() != tlv::nfd::FaceQueryFilter) {
-    throw Error("expecting FaceQueryFilter block");
+    BOOST_THROW_EXCEPTION(Error("expecting FaceQueryFilter block"));
   }
 
   m_wire = block;
@@ -350,4 +350,3 @@
 
 } // namespace nfd
 } // namespace ndn
-
diff --git a/src/management/nfd-face-status.cpp b/src/management/nfd-face-status.cpp
index becaa75..30af9fb 100644
--- a/src/management/nfd-face-status.cpp
+++ b/src/management/nfd-face-status.cpp
@@ -115,7 +115,7 @@
 FaceStatus::wireDecode(const Block& block)
 {
   if (block.type() != tlv::nfd::FaceStatus) {
-    throw Error("expecting FaceStatus block");
+    BOOST_THROW_EXCEPTION(Error("expecting FaceStatus block"));
   }
   m_wire = block;
   m_wire.parse();
@@ -126,7 +126,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FaceId field");
+    BOOST_THROW_EXCEPTION(Error("missing required FaceId field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Uri) {
@@ -134,7 +134,7 @@
     ++val;
   }
   else {
-    throw Error("missing required Uri field");
+    BOOST_THROW_EXCEPTION(Error("missing required Uri field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::LocalUri) {
@@ -142,7 +142,7 @@
     ++val;
   }
   else {
-    throw Error("missing required LocalUri field");
+    BOOST_THROW_EXCEPTION(Error("missing required LocalUri field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::ExpirationPeriod) {
@@ -160,7 +160,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FaceScope field");
+    BOOST_THROW_EXCEPTION(Error("missing required FaceScope field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::FacePersistency) {
@@ -168,7 +168,7 @@
     ++val;
   }
   else {
-    throw Error("missing required FacePersistency field");
+    BOOST_THROW_EXCEPTION(Error("missing required FacePersistency field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::LinkType) {
@@ -176,7 +176,7 @@
     ++val;
   }
   else {
-    throw Error("missing required LinkType field");
+    BOOST_THROW_EXCEPTION(Error("missing required LinkType field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInInterests) {
@@ -184,7 +184,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NInInterests field");
+    BOOST_THROW_EXCEPTION(Error("missing required NInInterests field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInDatas) {
@@ -192,7 +192,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NInDatas field");
+    BOOST_THROW_EXCEPTION(Error("missing required NInDatas field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutInterests) {
@@ -200,7 +200,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NOutInterests field");
+    BOOST_THROW_EXCEPTION(Error("missing required NOutInterests field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutDatas) {
@@ -208,7 +208,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NOutDatas field");
+    BOOST_THROW_EXCEPTION(Error("missing required NOutDatas field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInBytes) {
@@ -216,7 +216,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NInBytes field");
+    BOOST_THROW_EXCEPTION(Error("missing required NInBytes field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutBytes) {
@@ -224,7 +224,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NOutBytes field");
+    BOOST_THROW_EXCEPTION(Error("missing required NOutBytes field"));
   }
 }
 
diff --git a/src/management/nfd-fib-entry.cpp b/src/management/nfd-fib-entry.cpp
index b8c5274..fb07329 100644
--- a/src/management/nfd-fib-entry.cpp
+++ b/src/management/nfd-fib-entry.cpp
@@ -124,31 +124,31 @@
     std::stringstream error;
     error << "Requested decoding of NextHopRecord, but Block is of a different type: #"
           << m_wire.type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
   m_wire.parse();
 
   Block::element_const_iterator val = m_wire.elements_begin();
   if (val == m_wire.elements_end()) {
-    throw Error("Unexpected end of NextHopRecord");
+    BOOST_THROW_EXCEPTION(Error("Unexpected end of NextHopRecord"));
   }
   else if (val->type() != tlv::nfd::FaceId) {
     std::stringstream error;
     error << "Expected FaceId, but Block is of a different type: #"
           << val->type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
   m_faceId = readNonNegativeInteger(*val);
   ++val;
 
   if (val == m_wire.elements_end()) {
-    throw Error("Unexpected end of NextHopRecord");
+    BOOST_THROW_EXCEPTION(Error("Unexpected end of NextHopRecord"));
   }
   else if (val->type() != tlv::nfd::Cost) {
     std::stringstream error;
     error << "Expected Cost, but Block is of a different type: #"
           << m_wire.type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
   m_cost = readNonNegativeInteger(*val);
 }
@@ -235,20 +235,20 @@
     std::stringstream error;
     error << "Requested decoding of FibEntry, but Block is of a different type: #"
           << m_wire.type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
 
   m_wire.parse();
 
   Block::element_const_iterator val = m_wire.elements_begin();
   if (val == m_wire.elements_end()) {
-    throw Error("Unexpected end of FibEntry");
+    BOOST_THROW_EXCEPTION(Error("Unexpected end of FibEntry"));
   }
   else if (val->type() != tlv::Name) {
     std::stringstream error;
     error << "Expected Name, but Block is of a different type: #"
           << val->type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
   m_prefix.wireDecode(*val);
   ++val;
@@ -258,7 +258,7 @@
       std::stringstream error;
       error << "Expected NextHopRecords, but Block is of a different type: #"
             << val->type();
-      throw Error(error.str());
+      BOOST_THROW_EXCEPTION(Error(error.str()));
     }
     m_nextHopRecords.push_back(NextHopRecord(*val));
   }
diff --git a/src/management/nfd-forwarder-status.cpp b/src/management/nfd-forwarder-status.cpp
index 4e989ee..81b3bb9 100644
--- a/src/management/nfd-forwarder-status.cpp
+++ b/src/management/nfd-forwarder-status.cpp
@@ -116,7 +116,7 @@
 ForwarderStatus::wireDecode(const Block& block)
 {
   if (block.type() != tlv::Content) {
-    throw Error("expecting Content block for Status payload");
+    BOOST_THROW_EXCEPTION(Error("expecting Content block for Status payload"));
   }
   m_wire = block;
   m_wire.parse();
@@ -127,7 +127,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NfdVersion field");
+    BOOST_THROW_EXCEPTION(Error("missing required NfdVersion field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::StartTimestamp) {
@@ -135,7 +135,7 @@
     ++val;
   }
   else {
-    throw Error("missing required StartTimestamp field");
+    BOOST_THROW_EXCEPTION(Error("missing required StartTimestamp field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::CurrentTimestamp) {
@@ -143,7 +143,7 @@
     ++val;
   }
   else {
-    throw Error("missing required CurrentTimestamp field");
+    BOOST_THROW_EXCEPTION(Error("missing required CurrentTimestamp field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NNameTreeEntries) {
@@ -151,7 +151,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NNameTreeEntries field");
+    BOOST_THROW_EXCEPTION(Error("missing required NNameTreeEntries field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NFibEntries) {
@@ -159,7 +159,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NFibEntries field");
+    BOOST_THROW_EXCEPTION(Error("missing required NFibEntries field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NPitEntries) {
@@ -167,7 +167,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NPitEntries field");
+    BOOST_THROW_EXCEPTION(Error("missing required NPitEntries field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NMeasurementsEntries) {
@@ -175,7 +175,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NMeasurementsEntries field");
+    BOOST_THROW_EXCEPTION(Error("missing required NMeasurementsEntries field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NCsEntries) {
@@ -183,7 +183,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NCsEntries field");
+    BOOST_THROW_EXCEPTION(Error("missing required NCsEntries field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInInterests) {
@@ -191,7 +191,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NInInterests field");
+    BOOST_THROW_EXCEPTION(Error("missing required NInInterests field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInDatas) {
@@ -199,7 +199,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NInDatas field");
+    BOOST_THROW_EXCEPTION(Error("missing required NInDatas field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutInterests) {
@@ -207,7 +207,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NOutInterests field");
+    BOOST_THROW_EXCEPTION(Error("missing required NOutInterests field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::NOutDatas) {
@@ -215,7 +215,7 @@
     ++val;
   }
   else {
-    throw Error("missing required NOutDatas field");
+    BOOST_THROW_EXCEPTION(Error("missing required NOutDatas field"));
   }
 }
 
diff --git a/src/management/nfd-local-control-header.hpp b/src/management/nfd-local-control-header.hpp
index 8108230..327035d 100644
--- a/src/management/nfd-local-control-header.hpp
+++ b/src/management/nfd-local-control-header.hpp
@@ -250,7 +250,8 @@
 {
   /// @todo should this be BOOST_ASSERT instead?  This is kind of unnecessary overhead
   if (empty(encodeMask))
-    throw Error("Requested wire for LocalControlHeader, but none of the fields are set or enabled");
+    BOOST_THROW_EXCEPTION(Error("Requested wire for LocalControlHeader, but none of the fields are "
+                                "set or enabled"));
 
   EncodingEstimator estimator;
   size_t length = wireEncode(estimator, payload.wireEncode().size(), encodeMask);
@@ -297,7 +298,7 @@
               m_cachingPolicy = CachingPolicy::NO_CACHE;
             }
             else {
-              throw Error("CachingPolicy: Missing required NoCache field");
+              BOOST_THROW_EXCEPTION(Error("CachingPolicy: Missing required NoCache field"));
             }
           }
           break;
diff --git a/src/management/nfd-rib-entry.cpp b/src/management/nfd-rib-entry.cpp
index ab78d5c..7c056cd 100644
--- a/src/management/nfd-rib-entry.cpp
+++ b/src/management/nfd-rib-entry.cpp
@@ -130,7 +130,7 @@
     std::stringstream error;
     error << "Expected Route Block, but Block is of a different type: #"
           << m_wire.type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
 
   m_wire.parse();
@@ -142,7 +142,7 @@
     ++val;
   }
   else {
-    throw Error("Missing required FaceId field");
+    BOOST_THROW_EXCEPTION(Error("Missing required FaceId field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Origin) {
@@ -150,7 +150,7 @@
     ++val;
   }
   else {
-    throw Error("Missing required Origin field");
+    BOOST_THROW_EXCEPTION(Error("Missing required Origin field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Cost) {
@@ -158,7 +158,7 @@
     ++val;
   }
   else {
-    throw Error("Missing required Cost field");
+    BOOST_THROW_EXCEPTION(Error("Missing required Cost field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Flags) {
@@ -166,7 +166,7 @@
     ++val;
   }
   else {
-    throw Error("Missing required Flags field");
+    BOOST_THROW_EXCEPTION(Error("Missing required Flags field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::ExpirationPeriod) {
@@ -272,7 +272,7 @@
     std::stringstream error;
     error << "Expected RibEntry Block, but Block is of a different type: #"
           << m_wire.type();
-    throw Error(error.str());
+    BOOST_THROW_EXCEPTION(Error(error.str()));
   }
 
   m_wire.parse();
@@ -284,7 +284,7 @@
     ++val;
   }
   else {
-    throw Error("Missing required Name field");
+    BOOST_THROW_EXCEPTION(Error("Missing required Name field"));
   }
 
   for (; val != m_wire.elements_end(); ++val) {
@@ -296,7 +296,7 @@
       std::stringstream error;
       error << "Expected Route Block, but Block is of a different type: #"
             << m_wire.type();
-      throw Error(error.str());
+      BOOST_THROW_EXCEPTION(Error(error.str()));
     }
   }
 }
diff --git a/src/management/nfd-strategy-choice.cpp b/src/management/nfd-strategy-choice.cpp
index 6283acd..659293c 100644
--- a/src/management/nfd-strategy-choice.cpp
+++ b/src/management/nfd-strategy-choice.cpp
@@ -82,7 +82,7 @@
 StrategyChoice::wireDecode(const Block& block)
 {
   if (block.type() != tlv::nfd::StrategyChoice) {
-    throw Error("expecting StrategyChoice block");
+    BOOST_THROW_EXCEPTION(Error("expecting StrategyChoice block"));
   }
   m_wire = block;
   m_wire.parse();
@@ -93,13 +93,13 @@
     ++val;
   }
   else {
-    throw Error("missing required Name field");
+    BOOST_THROW_EXCEPTION(Error("missing required Name field"));
   }
 
   if (val != m_wire.elements_end() && val->type() == tlv::nfd::Strategy) {
     val->parse();
     if (val->elements().empty()) {
-      throw Error("expecting Strategy/Name");
+      BOOST_THROW_EXCEPTION(Error("expecting Strategy/Name"));
     }
     else {
       m_strategy.wireDecode(*val->elements_begin());
@@ -107,7 +107,7 @@
     ++val;
   }
   else {
-    throw Error("missing required Strategy field");
+    BOOST_THROW_EXCEPTION(Error("missing required Strategy field"));
   }
 }
 
diff --git a/src/meta-info.cpp b/src/meta-info.cpp
index a1bfa18..1fb2d9f 100644
--- a/src/meta-info.cpp
+++ b/src/meta-info.cpp
@@ -78,7 +78,8 @@
 {
   for (std::list<Block>::const_iterator i = info.begin(); i != info.end(); ++i) {
     if (!(128 <= i->type() && i->type() <= 252))
-      throw Error("AppMetaInfo block has type outside the application range [128, 252]");
+      BOOST_THROW_EXCEPTION(Error("AppMetaInfo block has type outside the application range "
+                                  "[128, 252]"));
   }
 
   m_wire.reset();
@@ -90,7 +91,8 @@
 MetaInfo::addAppMetaInfo(const Block& block)
 {
   if (!(128 <= block.type() && block.type() <= 252))
-    throw Error("AppMetaInfo block has type outside the application range [128, 252]");
+    BOOST_THROW_EXCEPTION(Error("AppMetaInfo block has type outside the application range "
+                                "[128, 252]"));
 
   m_wire.reset();
   m_appMetaInfo.push_back(block);
diff --git a/src/name-component.cpp b/src/name-component.cpp
index dbe9998..9226eb4 100644
--- a/src/name-component.cpp
+++ b/src/name-component.cpp
@@ -59,8 +59,8 @@
   : Block(wire)
 {
   if (!isGeneric() && !isImplicitSha256Digest())
-    throw Error("Cannot construct name::Component from not a NameComponent "
-                "or ImplicitSha256DigestComponent TLV wire block");
+    BOOST_THROW_EXCEPTION(Error("Cannot construct name::Component from not a NameComponent "
+                                "or ImplicitSha256DigestComponent TLV wire block"));
 }
 
 Component::Component(const ConstBufferPtr& buffer)
@@ -98,15 +98,16 @@
   if (trimmedString.compare(0, getSha256DigestUriPrefix().size(),
                             getSha256DigestUriPrefix()) == 0) {
     if (trimmedString.size() != getSha256DigestUriPrefix().size() + crypto::SHA256_DIGEST_SIZE * 2)
-      throw Error("Cannot convert to ImplicitSha256DigestComponent"
-                  "(expected sha256 in hex encoding)");
+      BOOST_THROW_EXCEPTION(Error("Cannot convert to ImplicitSha256DigestComponent"
+                                  "(expected sha256 in hex encoding)"));
 
     try {
       trimmedString.erase(0, getSha256DigestUriPrefix().size());
       return fromImplicitSha256Digest(fromHex(trimmedString));
     }
     catch (StringHelperError& e) {
-      throw Error("Cannot convert to a ImplicitSha256DigestComponent (invalid hex encoding)");
+      BOOST_THROW_EXCEPTION(Error("Cannot convert to a ImplicitSha256DigestComponent (invalid hex "
+                                  "encoding)"));
     }
   }
   else {
@@ -116,7 +117,7 @@
       // Special case for component of only periods.
       if (value.size() <= 2)
         // Zero, one or two periods is illegal.  Ignore this component.
-        throw Error("Illegal URI (name component cannot be . or ..)");
+        BOOST_THROW_EXCEPTION(Error("Illegal URI (name component cannot be . or ..)"));
       else
         // Remove 3 periods.
         return Component(reinterpret_cast<const uint8_t*>(&value[3]), value.size() - 3);
@@ -238,7 +239,7 @@
 Component::toNumber() const
 {
   if (!isNumber())
-    throw Error("Name component does not have nonNegativeInteger value");
+    BOOST_THROW_EXCEPTION(Error("Name component does not have nonNegativeInteger value"));
 
   return readNonNegativeInteger(*this);
 }
@@ -247,8 +248,8 @@
 Component::toNumberWithMarker(uint8_t marker) const
 {
   if (!isNumberWithMarker(marker))
-    throw Error("Name component does not have the requested marker "
-                "or the value is not a nonNegativeInteger");
+    BOOST_THROW_EXCEPTION(Error("Name component does not have the requested marker "
+                                "or the value is not a nonNegativeInteger"));
 
   Buffer::const_iterator valueBegin = value_begin() + 1;
   return tlv::readNonNegativeInteger(value_size() - 1, valueBegin, value_end());
@@ -364,8 +365,8 @@
 Component::fromImplicitSha256Digest(const ConstBufferPtr& digest)
 {
   if (digest->size() != crypto::SHA256_DIGEST_SIZE)
-    throw Error("Cannot create ImplicitSha256DigestComponent (input digest must be " +
-                boost::lexical_cast<std::string>(crypto::SHA256_DIGEST_SIZE) + " octets)");
+    BOOST_THROW_EXCEPTION(Error("Cannot create ImplicitSha256DigestComponent (input digest must be " +
+                                std::to_string(crypto::SHA256_DIGEST_SIZE) + " octets)"));
 
   return Block(tlv::ImplicitSha256DigestComponent, digest);
 }
@@ -374,8 +375,8 @@
 Component::fromImplicitSha256Digest(const uint8_t* digest, size_t digestSize)
 {
   if (digestSize != crypto::SHA256_DIGEST_SIZE)
-    throw Error("Cannot create ImplicitSha256DigestComponent (input digest must be " +
-                boost::lexical_cast<std::string>(crypto::SHA256_DIGEST_SIZE) + " octets)");
+    BOOST_THROW_EXCEPTION(Error("Cannot create ImplicitSha256DigestComponent (input digest must be "
+                                + std::to_string(crypto::SHA256_DIGEST_SIZE) + " octets)"));
 
   return makeBinaryBlock(tlv::ImplicitSha256DigestComponent, digest, digestSize);
 }
diff --git a/src/name.cpp b/src/name.cpp
index 1ba3bfd..2e2dd6c 100644
--- a/src/name.cpp
+++ b/src/name.cpp
@@ -108,7 +108,7 @@
 Name::wireDecode(const Block& wire)
 {
   if (wire.type() != tlv::Name)
-    throw tlv::Error("Unexpected TLV type when decoding Name");
+    BOOST_THROW_EXCEPTION(tlv::Error("Unexpected TLV type when decoding Name"));
 
   m_nameBlock = wire;
   m_nameBlock.parse();
diff --git a/src/name.hpp b/src/name.hpp
index d6040e6..7e228b7 100644
--- a/src/name.hpp
+++ b/src/name.hpp
@@ -443,7 +443,7 @@
   {
     if ((i >= 0 && static_cast<size_t>(i) >= size()) ||
         (i < 0  && static_cast<size_t>(-i) > size()))
-      throw Error("Requested component does not exist (out of bounds)");
+      BOOST_THROW_EXCEPTION(Error("Requested component does not exist (out of bounds)"));
 
     return get(i);
   }
diff --git a/src/security/additional-description.cpp b/src/security/additional-description.cpp
index 6aed34a..c912638 100644
--- a/src/security/additional-description.cpp
+++ b/src/security/additional-description.cpp
@@ -46,7 +46,7 @@
 {
   auto it = m_info.find(key);
   if (it == m_info.end())
-    throw Error("Entry does not exist for key (" + key + ")");
+    BOOST_THROW_EXCEPTION(Error("Entry does not exist for key (" + key + ")"));
 
   return it->second;
 }
@@ -136,14 +136,14 @@
 AdditionalDescription::wireDecode(const Block& wire)
 {
    if (!wire.hasWire()) {
-    throw Error("The supplied block does not contain wire format");
+     BOOST_THROW_EXCEPTION(Error("The supplied block does not contain wire format"));
   }
 
   m_wire = wire;
   m_wire.parse();
 
   if (m_wire.type() != tlv::AdditionalDescription)
-    throw Error("Unexpected TLV type when decoding AdditionalDescription");
+    BOOST_THROW_EXCEPTION(Error("Unexpected TLV type when decoding AdditionalDescription"));
 
   Block::element_const_iterator it = m_wire.elements_begin();
   while (it != m_wire.elements_end()) {
@@ -151,14 +151,14 @@
     entry.parse();
 
     if (entry.type() != tlv::DescriptionEntry)
-      throw Error("Unexpected TLV type when decoding DescriptionEntry");
+      BOOST_THROW_EXCEPTION(Error("Unexpected TLV type when decoding DescriptionEntry"));
 
     if (entry.elements_size() != 2)
-      throw Error("DescriptionEntry does not have two sub-TLVs");
+      BOOST_THROW_EXCEPTION(Error("DescriptionEntry does not have two sub-TLVs"));
 
     if (entry.elements()[KEY_OFFSET].type() != tlv::DescriptionKey ||
         entry.elements()[VALUE_OFFSET].type() != tlv::DescriptionValue)
-      throw Error("Invalid DescriptionKey or DescriptionValue field");
+      BOOST_THROW_EXCEPTION(Error("Invalid DescriptionKey or DescriptionValue field"));
 
     m_info[readString(entry.elements()[KEY_OFFSET])] = readString(entry.elements()[VALUE_OFFSET]);
     it++;
diff --git a/src/security/certificate.cpp b/src/security/certificate.cpp
index e25a92e..837872a 100644
--- a/src/security/certificate.cpp
+++ b/src/security/certificate.cpp
@@ -261,7 +261,7 @@
     idCert.MessageEnd();
   }
   catch (CryptoPP::BERDecodeErr&) {
-    throw Error("Certificate Decoding Error");
+    BOOST_THROW_EXCEPTION(Error("Certificate Decoding Error"));
   }
 }
 
diff --git a/src/security/conf/checker.hpp b/src/security/conf/checker.hpp
index 1364229..bb651bc 100644
--- a/src/security/conf/checker.hpp
+++ b/src/security/conf/checker.hpp
@@ -104,14 +104,14 @@
       case tlv::SignatureSha256WithEcdsa:
         {
           if (!static_cast<bool>(m_keyLocatorChecker))
-            throw Error("Strong signature requires KeyLocatorChecker");
+            BOOST_THROW_EXCEPTION(Error("Strong signature requires KeyLocatorChecker"));
 
           return;
         }
       case tlv::DigestSha256:
         return;
       default:
-        throw Error("Unsupported signature type");
+        BOOST_THROW_EXCEPTION(Error("Unsupported signature type"));
       }
   }
 
@@ -245,7 +245,7 @@
     if (sigType != tlv::SignatureSha256WithRsa &&
         sigType != tlv::SignatureSha256WithEcdsa)
       {
-        throw Error("FixedSigner is only meaningful for strong signature type");
+        BOOST_THROW_EXCEPTION(Error("FixedSigner is only meaningful for strong signature type"));
       }
 
   }
@@ -389,7 +389,7 @@
 
     // Get checker.type
     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "type"))
-      throw Error("Expect <checker.type>");
+      BOOST_THROW_EXCEPTION(Error("Expect <checker.type>"));
 
     std::string type = propertyIt->second.data();
 
@@ -400,7 +400,7 @@
     else if (boost::iequals(type, "fixed-signer"))
       return createFixedSignerChecker(configSection, configFilename);
     else
-      throw Error("Unsupported checker type: " + type);
+      BOOST_THROW_EXCEPTION(Error("Unsupported checker type: " + type));
   }
 
 private:
@@ -413,21 +413,21 @@
 
     // Get checker.sig-type
     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "sig-type"))
-      throw Error("Expect <checker.sig-type>");
+      BOOST_THROW_EXCEPTION(Error("Expect <checker.sig-type>"));
 
     std::string sigType = propertyIt->second.data();
     propertyIt++;
 
     // Get checker.key-locator
     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "key-locator"))
-      throw Error("Expect <checker.key-locator>");
+      BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator>"));
 
     shared_ptr<KeyLocatorChecker> keyLocatorChecker =
       KeyLocatorCheckerFactory::create(propertyIt->second, configFilename);
     propertyIt++;
 
     if (propertyIt != configSection.end())
-      throw Error("Expect the end of checker");
+      BOOST_THROW_EXCEPTION(Error("Expect the end of checker"));
 
     return make_shared<CustomizedChecker>(getSigType(sigType), keyLocatorChecker);
   }
@@ -441,13 +441,13 @@
 
     // Get checker.sig-type
     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "sig-type"))
-      throw Error("Expect <checker.sig-type>");
+      BOOST_THROW_EXCEPTION(Error("Expect <checker.sig-type>"));
 
     std::string sigType = propertyIt->second.data();
     propertyIt++;
 
     if (propertyIt != configSection.end())
-      throw Error("Expect the end of checker");
+      BOOST_THROW_EXCEPTION(Error("Expect the end of checker"));
 
     return make_shared<HierarchicalChecker>(getSigType(sigType));
   }
@@ -461,7 +461,7 @@
 
     // Get checker.sig-type
     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "sig-type"))
-      throw Error("Expect <checker.sig-type>");
+      BOOST_THROW_EXCEPTION(Error("Expect <checker.sig-type>"));
 
     std::string sigType = propertyIt->second.data();
     propertyIt++;
@@ -470,14 +470,14 @@
     for (; propertyIt != configSection.end(); propertyIt++)
       {
         if (!boost::iequals(propertyIt->first, "signer"))
-          throw Error("Expect <checker.signer> but get <checker." +
-                      propertyIt->first + ">");
+          BOOST_THROW_EXCEPTION(Error("Expect <checker.signer> but get <checker." +
+                                      propertyIt->first + ">"));
 
         signers.push_back(getSigner(propertyIt->second, configFilename));
       }
 
     if (propertyIt != configSection.end())
-      throw Error("Expect the end of checker");
+      BOOST_THROW_EXCEPTION(Error("Expect the end of checker"));
 
     return shared_ptr<FixedSignerChecker>(new FixedSignerChecker(getSigType(sigType),
                                                                  signers));
@@ -492,7 +492,7 @@
 
     // Get checker.signer.type
     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "type"))
-      throw Error("Expect <checker.signer.type>");
+      BOOST_THROW_EXCEPTION(Error("Expect <checker.signer.type>"));
 
     std::string type = propertyIt->second.data();
     propertyIt++;
@@ -501,14 +501,14 @@
       {
         // Get checker.signer.file-name
         if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "file-name"))
-          throw Error("Expect <checker.signer.file-name>");
+          BOOST_THROW_EXCEPTION(Error("Expect <checker.signer.file-name>"));
 
         path certfilePath = absolute(propertyIt->second.data(),
                                      path(configFilename).parent_path());
         propertyIt++;
 
         if (propertyIt != configSection.end())
-          throw Error("Expect the end of checker.signer");
+          BOOST_THROW_EXCEPTION(Error("Expect the end of checker.signer"));
 
         shared_ptr<IdentityCertificate> idCert
           = io::load<IdentityCertificate>(certfilePath.c_str());
@@ -516,31 +516,31 @@
         if (static_cast<bool>(idCert))
           return idCert;
         else
-          throw Error("Cannot read certificate from file: " +
-                      certfilePath.native());
+          BOOST_THROW_EXCEPTION(Error("Cannot read certificate from file: " +
+                                      certfilePath.native()));
       }
     else if (boost::iequals(type, "base64"))
       {
         // Get checker.signer.base64-string
         if (propertyIt == configSection.end() ||
             !boost::iequals(propertyIt->first, "base64-string"))
-          throw Error("Expect <checker.signer.base64-string>");
+          BOOST_THROW_EXCEPTION(Error("Expect <checker.signer.base64-string>"));
 
         std::stringstream ss(propertyIt->second.data());
         propertyIt++;
 
         if (propertyIt != configSection.end())
-          throw Error("Expect the end of checker.signer");
+          BOOST_THROW_EXCEPTION(Error("Expect the end of checker.signer"));
 
         shared_ptr<IdentityCertificate> idCert = io::load<IdentityCertificate>(ss);
 
         if (static_cast<bool>(idCert))
           return idCert;
         else
-          throw Error("Cannot decode certificate from string");
+          BOOST_THROW_EXCEPTION(Error("Cannot decode certificate from string"));
       }
     else
-      throw Error("Unsupported checker.signer type: " + type);
+      BOOST_THROW_EXCEPTION(Error("Unsupported checker.signer type: " + type));
   }
 
   static uint32_t
@@ -553,7 +553,7 @@
     else if (boost::iequals(sigType, "sha256"))
       return tlv::DigestSha256;
     else
-      throw Error("Unsupported signature type");
+      BOOST_THROW_EXCEPTION(Error("Unsupported signature type"));
   }
 };
 
diff --git a/src/security/conf/filter.hpp b/src/security/conf/filter.hpp
index 8d0601c..3dfddde 100644
--- a/src/security/conf/filter.hpp
+++ b/src/security/conf/filter.hpp
@@ -152,14 +152,14 @@
     ConfigSection::const_iterator propertyIt = configSection.begin();
 
     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "type"))
-      throw Error("Expect <filter.type>!");
+      BOOST_THROW_EXCEPTION(Error("Expect <filter.type>!"));
 
     std::string type = propertyIt->second.data();
 
     if (boost::iequals(type, "name"))
       return createNameFilter(configSection);
     else
-      throw Error("Unsupported filter.type: " + type);
+      BOOST_THROW_EXCEPTION(Error("Unsupported filter.type: " + type));
   }
 private:
   static shared_ptr<Filter>
@@ -169,7 +169,7 @@
     propertyIt++;
 
     if (propertyIt == configSection.end())
-      throw Error("Expect more properties for filter(name)");
+      BOOST_THROW_EXCEPTION(Error("Expect more properties for filter(name)"));
 
     if (boost::iequals(propertyIt->first, "name"))
       {
@@ -181,14 +181,14 @@
           }
         catch (Name::Error& e)
           {
-            throw Error("Wrong filter.name: " + propertyIt->second.data());
+            BOOST_THROW_EXCEPTION(Error("Wrong filter.name: " + propertyIt->second.data()));
           }
 
         propertyIt++;
 
         // Get filter.relation
         if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "relation"))
-          throw Error("Expect <filter.relation>!");
+          BOOST_THROW_EXCEPTION(Error("Expect <filter.relation>!"));
 
         std::string relationString = propertyIt->second.data();
         propertyIt++;
@@ -201,11 +201,11 @@
         else if (boost::iequals(relationString, "is-strict-prefix-of"))
           relation = RelationNameFilter::RELATION_IS_STRICT_PREFIX_OF;
         else
-          throw Error("Unsupported relation: " + relationString);
+          BOOST_THROW_EXCEPTION(Error("Unsupported relation: " + relationString));
 
 
         if (propertyIt != configSection.end())
-          throw Error("Expect the end of filter!");
+          BOOST_THROW_EXCEPTION(Error("Expect the end of filter!"));
 
         return make_shared<RelationNameFilter>(name, relation);
       }
@@ -215,7 +215,7 @@
         propertyIt++;
 
         if (propertyIt != configSection.end())
-          throw Error("Expect the end of filter!");
+          BOOST_THROW_EXCEPTION(Error("Expect the end of filter!"));
 
         try
           {
@@ -223,11 +223,11 @@
           }
         catch (Regex::Error& e)
           {
-            throw Error("Wrong filter.regex: " + regexString);
+            BOOST_THROW_EXCEPTION(Error("Wrong filter.regex: " + regexString));
           }
       }
     else
-      throw Error("Wrong filter(name) properties");
+      BOOST_THROW_EXCEPTION(Error("Wrong filter(name) properties"));
   }
 };
 
diff --git a/src/security/conf/key-locator-checker.hpp b/src/security/conf/key-locator-checker.hpp
index 7d5bb9c..667dfeb 100644
--- a/src/security/conf/key-locator-checker.hpp
+++ b/src/security/conf/key-locator-checker.hpp
@@ -234,14 +234,14 @@
 
     // Get checker.key-locator.type
     if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "type"))
-      throw Error("Expect <checker.key-locator.type>!");
+      BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.type>!"));
 
     std::string type = propertyIt->second.data();
 
     if (boost::iequals(type, "name"))
       return createKeyLocatorNameChecker(configSection, filename);
     else
-      throw Error("Unsupported checker.key-locator.type: " + type);
+      BOOST_THROW_EXCEPTION(Error("Unsupported checker.key-locator.type: " + type));
   }
 
 private:
@@ -253,7 +253,7 @@
     propertyIt++;
 
     if (propertyIt == configSection.end())
-      throw Error("Expect more checker.key-locator properties");
+      BOOST_THROW_EXCEPTION(Error("Expect more checker.key-locator properties"));
 
     if (boost::iequals(propertyIt->first, "name"))
       {
@@ -264,13 +264,13 @@
           }
         catch (Name::Error& e)
           {
-            throw Error("Invalid checker.key-locator.name: " +
-                        propertyIt->second.data());
+            BOOST_THROW_EXCEPTION(Error("Invalid checker.key-locator.name: " +
+                                        propertyIt->second.data()));
           }
         propertyIt++;
 
         if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "relation"))
-          throw Error("Expect <checker.key-locator.relation>!");
+          BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.relation>!"));
 
         std::string relationString = propertyIt->second.data();
         propertyIt++;
@@ -283,10 +283,10 @@
         else if (boost::iequals(relationString, "is-strict-prefix-of"))
           relation = KeyLocatorChecker::RELATION_IS_STRICT_PREFIX_OF;
         else
-          throw Error("Unsupported relation: " + relationString);
+          BOOST_THROW_EXCEPTION(Error("Unsupported relation: " + relationString));
 
         if (propertyIt != configSection.end())
-          throw Error("Expect the end of checker.key-locator!");
+          BOOST_THROW_EXCEPTION(Error("Expect the end of checker.key-locator!"));
 
         return shared_ptr<RelationKeyLocatorNameChecker>
           (new RelationKeyLocatorNameChecker(name, relation));
@@ -297,7 +297,7 @@
         propertyIt++;
 
         if (propertyIt != configSection.end())
-          throw Error("Expect the end of checker.key-locator!");
+          BOOST_THROW_EXCEPTION(Error("Expect the end of checker.key-locator!"));
 
         try
           {
@@ -306,7 +306,7 @@
           }
         catch (Regex::Error& e)
           {
-            throw Error("Invalid checker.key-locator.regex: " + regexString);
+            BOOST_THROW_EXCEPTION(Error("Invalid checker.key-locator.regex: " + regexString));
           }
       }
     else if (boost::iequals(propertyIt->first, "hyper-relation"))
@@ -317,41 +317,41 @@
 
         // Get k-regex
         if (hPropertyIt == hSection.end() || !boost::iequals(hPropertyIt->first, "k-regex"))
-          throw Error("Expect <checker.key-locator.hyper-relation.k-regex>!");
+          BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.hyper-relation.k-regex>!"));
 
         std::string kRegex = hPropertyIt->second.data();
         hPropertyIt++;
 
         // Get k-expand
         if (hPropertyIt == hSection.end() || !boost::iequals(hPropertyIt->first, "k-expand"))
-          throw Error("Expect <checker.key-locator.hyper-relation.k-expand>!");
+          BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.hyper-relation.k-expand>!"));
 
         std::string kExpand = hPropertyIt->second.data();
         hPropertyIt++;
 
         // Get h-relation
         if (hPropertyIt == hSection.end() || !boost::iequals(hPropertyIt->first, "h-relation"))
-          throw Error("Expect <checker.key-locator.hyper-relation.h-relation>!");
+          BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.hyper-relation.h-relation>!"));
 
         std::string hRelation = hPropertyIt->second.data();
         hPropertyIt++;
 
         // Get p-regex
         if (hPropertyIt == hSection.end() || !boost::iequals(hPropertyIt->first, "p-regex"))
-          throw Error("Expect <checker.key-locator.hyper-relation.p-regex>!");
+          BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.hyper-relation.p-regex>!"));
 
         std::string pRegex = hPropertyIt->second.data();
         hPropertyIt++;
 
         // Get p-expand
         if (hPropertyIt == hSection.end() || !boost::iequals(hPropertyIt->first, "p-expand"))
-          throw Error("Expect <checker.key-locator.hyper-relation.p-expand>!");
+          BOOST_THROW_EXCEPTION(Error("Expect <checker.key-locator.hyper-relation.p-expand>!"));
 
         std::string pExpand = hPropertyIt->second.data();
         hPropertyIt++;
 
         if (hPropertyIt != hSection.end())
-          throw Error("Expect the end of checker.key-locator.hyper-relation!");
+          BOOST_THROW_EXCEPTION(Error("Expect the end of checker.key-locator.hyper-relation!"));
 
         KeyLocatorChecker::Relation relation;
         if (boost::iequals(hRelation, "equal"))
@@ -361,7 +361,8 @@
         else if (boost::iequals(hRelation, "is-strict-prefix-of"))
           relation = KeyLocatorChecker::RELATION_IS_STRICT_PREFIX_OF;
         else
-          throw Error("Unsupported checker.key-locator.hyper-relation.h-relation: " + hRelation);
+          BOOST_THROW_EXCEPTION(Error("Unsupported checker.key-locator.hyper-relation.h-relation: "
+                                      + hRelation));
 
         try
           {
@@ -372,11 +373,11 @@
           }
         catch (Regex::Error& e)
           {
-            throw Error("Invalid regex for key-locator.hyper-relation");
+            BOOST_THROW_EXCEPTION(Error("Invalid regex for key-locator.hyper-relation"));
           }
       }
     else
-      throw Error("Unsupported checker.key-locator");
+      BOOST_THROW_EXCEPTION(Error("Unsupported checker.key-locator"));
   }
 };
 
diff --git a/src/security/digest-sha256.cpp b/src/security/digest-sha256.cpp
index 3af551a..6e37eb5 100644
--- a/src/security/digest-sha256.cpp
+++ b/src/security/digest-sha256.cpp
@@ -32,7 +32,7 @@
   : Signature(signature)
 {
   if (getType() != tlv::DigestSha256)
-    throw Error("Incorrect signature type");
+    BOOST_THROW_EXCEPTION(Error("Incorrect signature type"));
 }
 
 } // namespace ndn
diff --git a/src/security/identity-certificate.cpp b/src/security/identity-certificate.cpp
index a80684e..1eaceac 100644
--- a/src/security/identity-certificate.cpp
+++ b/src/security/identity-certificate.cpp
@@ -94,7 +94,7 @@
 IdentityCertificate::setPublicKeyName()
 {
   if (!isCorrectName(getName()))
-    throw Error("Wrong Identity Certificate Name!");
+    BOOST_THROW_EXCEPTION(Error("Wrong Identity Certificate Name"));
 
   m_publicKeyName = certificateNameToPublicKeyName(getName());
 }
@@ -120,7 +120,7 @@
   }
 
   if (!foundIdString)
-    throw Error("Incorrect identity certificate name " + certificateName.toUri());
+    BOOST_THROW_EXCEPTION(Error("Incorrect identity certificate name " + certificateName.toUri()));
 
   Name tmpName = certificateName.getSubName(0, idCertComponentIndex);
   string keyString("KEY");
@@ -135,7 +135,7 @@
   }
 
   if (!foundKeyString)
-    throw Error("Incorrect identity certificate name " + certificateName.toUri());
+    BOOST_THROW_EXCEPTION(Error("Incorrect identity certificate name " + certificateName.toUri()));
 
   return tmpName
            .getSubName(0, keyComponentIndex)
diff --git a/src/security/identity.cpp b/src/security/identity.cpp
index 128b7bc..1093b9f 100644
--- a/src/security/identity.cpp
+++ b/src/security/identity.cpp
@@ -46,7 +46,7 @@
   if (needInit)
     m_impl->addIdentity(m_name);
   else if (!m_impl->hasIdentity(m_name))
-    throw Pib::Error("Identity: " + m_name.toUri() + " does not exist");
+    BOOST_THROW_EXCEPTION(Pib::Error("Identity: " + m_name.toUri() + " does not exist"));
 }
 
 const Name&
@@ -157,7 +157,7 @@
 Identity::validityCheck() const
 {
   if (m_impl == nullptr)
-    throw std::domain_error("Invalid Identity instance");
+    BOOST_THROW_EXCEPTION(std::domain_error("Invalid Identity instance"));
 }
 
 } // namespace security
diff --git a/src/security/key-chain.cpp b/src/security/key-chain.cpp
index 2950a50..16bc879 100644
--- a/src/security/key-chain.cpp
+++ b/src/security/key-chain.cpp
@@ -177,7 +177,7 @@
 
   auto pibFactory = getPibFactories().find(pibScheme);
   if (pibFactory == getPibFactories().end()) {
-    throw KeyChain::Error("PIB scheme '" + pibScheme + "' is not supported");
+    BOOST_THROW_EXCEPTION(KeyChain::Error("PIB scheme '" + pibScheme + "' is not supported"));
   }
   pibScheme = pibFactory->second.canonicalName;
 
@@ -214,7 +214,7 @@
   }
   auto tpmFactory = getTpmFactories().find(tpmScheme);
   if (tpmFactory == getTpmFactories().end()) {
-    throw KeyChain::Error("TPM scheme '" + tpmScheme + "' is not supported");
+    BOOST_THROW_EXCEPTION(KeyChain::Error("TPM scheme '" + tpmScheme + "' is not supported"));
   }
   tpmScheme = tpmFactory->second.canonicalName;
 
@@ -256,8 +256,8 @@
     if (!allowReset &&
         !m_pib->getTpmLocator().empty() && m_pib->getTpmLocator() != canonicalTpmLocator)
       // Tpm mismatch, but we do not want to reset PIB
-      throw MismatchError("TPM locator supplied does not match TPM locator in PIB: " +
-                          m_pib->getTpmLocator() + " != " + canonicalTpmLocator);
+      BOOST_THROW_EXCEPTION(MismatchError("TPM locator supplied does not match TPM locator in PIB: "
+                                          + m_pib->getTpmLocator() + " != " + canonicalTpmLocator));
   }
   catch (SecPublicInfo::Error&) {
     // TPM locator is not set in PIB yet.
@@ -482,7 +482,7 @@
         signingCertName = m_pib->getDefaultCertificateNameForKey(params.getSignerName());
       }
       catch (SecPublicInfo::Error&) {
-        throw Error("signing certificate does not exist");
+        BOOST_THROW_EXCEPTION(Error("signing certificate does not exist"));
       }
 
       signingCert = m_pib->getCertificate(signingCertName);
@@ -493,7 +493,7 @@
     {
       signingCert = m_pib->getCertificate(params.getSignerName());
       if (signingCert == nullptr)
-        throw Error("signing certificate does not exist");
+        BOOST_THROW_EXCEPTION(Error("signing certificate does not exist"));
 
       break;
     }
@@ -503,7 +503,7 @@
       return std::make_tuple(DIGEST_SHA256_IDENTITY, sigInfo);
     }
   default:
-    throw Error("Unrecognized signer type");
+    BOOST_THROW_EXCEPTION(Error("Unrecognized signer type"));
   }
 
   sigInfo.setSignatureType(getSignatureType(signingCert->getPublicKeyInfo().getKeyType(),
@@ -540,7 +540,7 @@
   shared_ptr<IdentityCertificate> certificate = m_pib->getCertificate(certificateName);
 
   if (certificate == nullptr)
-    throw SecPublicInfo::Error("certificate does not exist");
+    BOOST_THROW_EXCEPTION(SecPublicInfo::Error("certificate does not exist"));
 
   Signature sig;
 
@@ -587,7 +587,7 @@
 {
   Name keyName = cert.getPublicKeyName();
   if (!m_tpm->doesKeyExistInTpm(keyName, KEY_CLASS_PRIVATE))
-    throw SecTpm::Error("Private key does not exist");
+    BOOST_THROW_EXCEPTION(SecTpm::Error("Private key does not exist"));
 
   SignatureInfo sigInfo(cert.getSignature().getInfo());
   sigInfo.setKeyLocator(KeyLocator(cert.getName().getPrefix(-1)));
@@ -601,7 +601,7 @@
 KeyChain::exportIdentity(const Name& identity, const std::string& passwordStr)
 {
   if (!m_pib->doesIdentityExist(identity))
-    throw SecPublicInfo::Error("Identity does not exist");
+    BOOST_THROW_EXCEPTION(SecPublicInfo::Error("Identity does not exist"));
 
   Name keyName = m_pib->getDefaultKeyNameForIdentity(identity);
 
@@ -612,7 +612,7 @@
     }
   catch (SecTpm::Error& e)
     {
-      throw SecPublicInfo::Error("Fail to export PKCS5 of private key");
+      BOOST_THROW_EXCEPTION(SecPublicInfo::Error("Fail to export PKCS5 of private key"));
     }
 
   shared_ptr<IdentityCertificate> cert;
@@ -842,7 +842,7 @@
     case KEY_TYPE_ECDSA:
       return tlv::SignatureSha256WithEcdsa;
     default:
-      throw Error("Unsupported key types");
+      BOOST_THROW_EXCEPTION(Error("Unsupported key types"));
   }
 
 }
diff --git a/src/security/key-params.hpp b/src/security/key-params.hpp
index d4840a2..1c911f4 100644
--- a/src/security/key-params.hpp
+++ b/src/security/key-params.hpp
@@ -128,7 +128,7 @@
   SimplePublicKeyParams(const KeyParams& params)
     : KeyParams(params.getKeyType())
   {
-    throw KeyParams::Error("Incorrect key parameters (incompatible key type)");
+    BOOST_THROW_EXCEPTION(KeyParams::Error("Incorrect key parameters (incompatible key type)"));
   }
 
   uint32_t
@@ -202,7 +202,7 @@
   explicit
   SimpleSymmetricKeyParams(const KeyParams& params)
   {
-    throw KeyParams::Error("Incorrect key parameters (incompatible key type)");
+    BOOST_THROW_EXCEPTION(KeyParams::Error("Incorrect key parameters (incompatible key type)"));
   }
 
   uint32_t
diff --git a/src/security/key.cpp b/src/security/key.cpp
index dc430c7..48c8aa3 100644
--- a/src/security/key.cpp
+++ b/src/security/key.cpp
@@ -194,7 +194,7 @@
 Key::validityCheck() const
 {
   if (m_impl == nullptr)
-    throw std::domain_error("Invalid Key instance");
+    BOOST_THROW_EXCEPTION(std::domain_error("Invalid Key instance"));
 }
 
 } // namespace security
diff --git a/src/security/pib-memory.cpp b/src/security/pib-memory.cpp
index 397b0db..09300f1 100644
--- a/src/security/pib-memory.cpp
+++ b/src/security/pib-memory.cpp
@@ -33,7 +33,7 @@
 void
 PibMemory::setTpmLocator(const std::string& tpmLocator)
 {
-  throw Error("PibMemory does not need a locator");
+  BOOST_THROW_EXCEPTION(Error("PibMemory does not need a locator"));
 }
 
 std::string
@@ -92,7 +92,7 @@
   if (m_hasDefaultIdentity)
     return m_defaultIdentity;
 
-  throw Pib::Error("No default identity");
+  BOOST_THROW_EXCEPTION(Pib::Error("No default identity"));
 }
 
 bool
@@ -131,7 +131,7 @@
 PibMemory::getKeyBits(const Name& identity, const name::Component& keyId) const
 {
   if (!hasKey(identity, keyId))
-    throw Pib::Error("No key");
+    BOOST_THROW_EXCEPTION(Pib::Error("No key"));
 
   auto it = m_keys.find(getKeyName(identity, keyId));
   return it->second;
@@ -154,7 +154,7 @@
   Name keyName = getKeyName(identity, keyId);
 
   if (!hasKey(identity, keyId))
-    throw Pib::Error("No key");
+    BOOST_THROW_EXCEPTION(Pib::Error("No key"));
 
   m_defaultKey[identity] = keyName;
 }
@@ -164,7 +164,7 @@
 {
   auto it = m_defaultKey.find(identity);
   if (it == m_defaultKey.end())
-    throw Pib::Error("No default key");
+    BOOST_THROW_EXCEPTION(Pib::Error("No default key"));
 
   return it->second.get(-1);
 }
@@ -208,7 +208,7 @@
 PibMemory::getCertificate(const Name& certName) const
 {
   if (!hasCertificate(certName))
-    throw Pib::Error("No cert");
+    BOOST_THROW_EXCEPTION(Pib::Error("No cert"));
 
   auto it = m_certs.find(certName);
   return it->second;
@@ -231,7 +231,7 @@
 PibMemory::setDefaultCertificateOfKey(const Name& identity, const name::Component& keyId, const Name& certName)
 {
   if (!hasCertificate(certName))
-    throw Pib::Error("No cert");
+    BOOST_THROW_EXCEPTION(Pib::Error("No cert"));
 
   Name keyName = getKeyName(identity, keyId);
   m_defaultCert[keyName] = certName;
@@ -244,11 +244,11 @@
 
   auto it = m_defaultCert.find(keyName);
   if (it == m_defaultCert.end())
-    throw Pib::Error("No default certificate");
+    BOOST_THROW_EXCEPTION(Pib::Error("No default certificate"));
 
   auto certIt = m_certs.find(it->second);
   if (certIt == m_certs.end())
-    throw Pib::Error("No default certificate");
+    BOOST_THROW_EXCEPTION(Pib::Error("No default certificate"));
   else
     return certIt->second;
 }
diff --git a/src/security/pib-sqlite3.cpp b/src/security/pib-sqlite3.cpp
index 3a95b5d..b20ee7c 100644
--- a/src/security/pib-sqlite3.cpp
+++ b/src/security/pib-sqlite3.cpp
@@ -217,7 +217,7 @@
   boost::filesystem::path actualDir;
   if (dir == "") {
     if (getenv("HOME") == nullptr)
-      throw PibImpl::Error("Environment variable HOME is not set");
+      BOOST_THROW_EXCEPTION(PibImpl::Error("Environment variable HOME is not set"));
 
     actualDir = boost::filesystem::path(getenv("HOME")) / ".ndn";
     boost::filesystem::create_directories(actualDir);
@@ -237,7 +237,7 @@
                                );
 
   if (result != SQLITE_OK)
-    throw PibImpl::Error("PIB DB cannot be opened/created: " + dir);
+    BOOST_THROW_EXCEPTION(PibImpl::Error("PIB DB cannot be opened/created: " + dir));
 
 
   // enable foreign key
@@ -248,7 +248,7 @@
   result = sqlite3_exec(m_database, INITIALIZATION.c_str(), nullptr, nullptr, &errorMessage);
   if (result != SQLITE_OK && errorMessage != nullptr) {
     sqlite3_free(errorMessage);
-    throw PibImpl::Error("PIB DB cannot be initialized");
+    BOOST_THROW_EXCEPTION(PibImpl::Error("PIB DB cannot be initialized"));
   }
 }
 
@@ -282,7 +282,7 @@
   if (res == SQLITE_ROW)
     return statement.getString(0);
   else
-    throw Pib::Error("TPM info does not exist");
+    BOOST_THROW_EXCEPTION(Pib::Error("TPM info does not exist"));
 }
 
 bool
@@ -337,7 +337,7 @@
   if (statement.step() == SQLITE_ROW)
     return Name(statement.getBlock(0));
   else
-    throw Pib::Error("No default identity");
+    BOOST_THROW_EXCEPTION(Pib::Error("No default identity"));
 }
 
 bool
@@ -395,7 +395,7 @@
   if (statement.step() == SQLITE_ROW)
     return PublicKey(statement.getBlob(0), statement.getSize(0));
   else
-    throw Pib::Error("Key does not exist");
+    BOOST_THROW_EXCEPTION(Pib::Error("Key does not exist"));
 }
 
 std::set<name::Component>
@@ -423,7 +423,7 @@
   Name keyName = getKeyName(identity, keyId);
 
   if (!hasKey(identity, keyId)) {
-    throw Pib::Error("No such key");
+    BOOST_THROW_EXCEPTION(Pib::Error("No such key"));
   }
 
   Sqlite3Statement statement(m_database, "UPDATE keys SET is_default=1 WHERE key_name=?");
@@ -435,7 +435,7 @@
 PibSqlite3::getDefaultKeyOfIdentity(const Name& identity) const
 {
   if (!hasIdentity(identity)) {
-    throw Pib::Error("Identity does not exist");
+    BOOST_THROW_EXCEPTION(Pib::Error("Identity does not exist"));
   }
 
   Sqlite3Statement statement(m_database,
@@ -449,7 +449,7 @@
     return keyName.get(-1);
   }
   else
-    throw Pib::Error("No default key");
+    BOOST_THROW_EXCEPTION(Pib::Error("No default key"));
 }
 
 bool
@@ -500,7 +500,7 @@
   if (statement.step() == SQLITE_ROW)
     return IdentityCertificate(statement.getBlock(0));
   else
-    throw Pib::Error("Certificate does not exit");
+    BOOST_THROW_EXCEPTION(Pib::Error("Certificate does not exit"));
 }
 
 std::set<Name>
@@ -527,7 +527,7 @@
                                        const Name& certName)
 {
   if (!hasCertificate(certName)) {
-    throw Pib::Error("Certificate does not exist");
+    BOOST_THROW_EXCEPTION(Pib::Error("Certificate does not exist"));
   }
 
   Sqlite3Statement statement(m_database,
@@ -550,7 +550,7 @@
   if (statement.step() == SQLITE_ROW)
     return IdentityCertificate(statement.getBlock(0));
   else
-    throw Pib::Error("Certificate does not exit");
+    BOOST_THROW_EXCEPTION(Pib::Error("Certificate does not exit"));
 }
 
 } // namespace security
diff --git a/src/security/public-key.cpp b/src/security/public-key.cpp
index 07b8137..5e0a607 100644
--- a/src/security/public-key.cpp
+++ b/src/security/public-key.cpp
@@ -46,7 +46,7 @@
 PublicKey::computeDigest() const
 {
   if (m_key.empty())
-    throw Error("Public key is empty");
+    BOOST_THROW_EXCEPTION(Error("Public key is empty"));
 
   if (m_digest.hasWire())
     return m_digest;
@@ -110,8 +110,8 @@
           else if (algorithm == oid::ECDSA)
             m_type = KEY_TYPE_ECDSA;
           else
-            throw Error("Only RSA/ECDSA public keys are supported for now (" +
-                        algorithm.toString() + " requested)");
+            BOOST_THROW_EXCEPTION(Error("Only RSA/ECDSA public keys are supported for now (" +
+                                        algorithm.toString() + " requested)"));
         }
       }
 
@@ -120,7 +120,7 @@
   catch (CryptoPP::BERDecodeErr& err)
     {
       m_type = KEY_TYPE_NULL;
-      throw Error("PublicKey decoding error");
+      BOOST_THROW_EXCEPTION(Error("PublicKey decoding error"));
     }
 
   m_digest.reset();
diff --git a/src/security/sec-public-info-sqlite3.cpp b/src/security/sec-public-info-sqlite3.cpp
index 65e394c..462f215 100644
--- a/src/security/sec-public-info-sqlite3.cpp
+++ b/src/security/sec-public-info-sqlite3.cpp
@@ -130,7 +130,7 @@
 #endif
                             );
   if (res != SQLITE_OK)
-    throw Error("identity DB cannot be opened/created");
+    BOOST_THROW_EXCEPTION(Error("identity DB cannot be opened/created"));
 
 
   BOOST_ASSERT(m_database != nullptr);
@@ -228,7 +228,7 @@
   }
   else {
     sqlite3_finalize(statement);
-    throw SecPublicInfo::Error("TPM info does not exist");
+    BOOST_THROW_EXCEPTION(SecPublicInfo::Error("TPM info does not exist"));
   }
 }
 
@@ -321,7 +321,7 @@
 SecPublicInfoSqlite3::doesPublicKeyExist(const Name& keyName)
 {
   if (keyName.empty())
-    throw Error("Incorrect key name " + keyName.toUri());
+    BOOST_THROW_EXCEPTION(Error("Incorrect key name " + keyName.toUri()));
 
   string keyId = keyName.get(-1).toUri();
   Name identityName = keyName.getPrefix(-1);
@@ -387,7 +387,7 @@
 SecPublicInfoSqlite3::getPublicKey(const Name& keyName)
 {
   if (keyName.empty())
-    throw Error("SecPublicInfoSqlite3::getPublicKey  Empty keyName");
+    BOOST_THROW_EXCEPTION(Error("SecPublicInfoSqlite3::getPublicKey  Empty keyName"));
 
   string keyId = keyName.get(-1).toUri();
   Name identityName = keyName.getPrefix(-1);
@@ -411,7 +411,7 @@
   }
   else {
     sqlite3_finalize(statement);
-    throw Error("SecPublicInfoSqlite3::getPublicKey  public key does not exist");
+    BOOST_THROW_EXCEPTION(Error("SecPublicInfoSqlite3::getPublicKey  public key does not exist"));
   }
 }
 
@@ -545,7 +545,8 @@
     }
     catch (tlv::Error&) {
       sqlite3_finalize(statement);
-      throw Error("SecPublicInfoSqlite3::getCertificate  certificate cannot be decoded");
+      BOOST_THROW_EXCEPTION(Error("SecPublicInfoSqlite3::getCertificate  certificate cannot be "
+                                  "decoded"));
     }
 
     sqlite3_finalize(statement);
@@ -553,7 +554,8 @@
   }
   else {
     sqlite3_finalize(statement);
-    throw Error("SecPublicInfoSqlite3::getCertificate  certificate does not exist");
+    BOOST_THROW_EXCEPTION(Error("SecPublicInfoSqlite3::getCertificate  certificate does not "
+                                "exist"));
   }
 }
 
@@ -575,7 +577,7 @@
   }
   else {
     sqlite3_finalize(statement);
-    throw Error("SecPublicInfoSqlite3::getDefaultIdentity  no default identity");
+    BOOST_THROW_EXCEPTION(Error("SecPublicInfoSqlite3::getDefaultIdentity  no default identity"));
   }
 }
 
@@ -629,7 +631,8 @@
   }
   else {
     sqlite3_finalize(statement);
-    throw Error("SecPublicInfoSqlite3::getDefaultKeyNameForIdentity key not found");
+    BOOST_THROW_EXCEPTION(Error("SecPublicInfoSqlite3::getDefaultKeyNameForIdentity key not "
+                                "found"));
   }
 }
 
@@ -637,7 +640,7 @@
 SecPublicInfoSqlite3::setDefaultKeyNameForIdentityInternal(const Name& keyName)
 {
   if (!doesPublicKeyExist(keyName))
-    throw Error("Key does not exist:" + keyName.toUri());
+    BOOST_THROW_EXCEPTION(Error("Key does not exist:" + keyName.toUri()));
 
   string keyId = keyName.get(-1).toUri();
   Name identityName = keyName.getPrefix(-1);
@@ -673,7 +676,7 @@
 SecPublicInfoSqlite3::getDefaultCertificateNameForKey(const Name& keyName)
 {
   if (keyName.empty())
-    throw Error("SecPublicInfoSqlite3::getDefaultCertificateNameForKey wrong key");
+    BOOST_THROW_EXCEPTION(Error("SecPublicInfoSqlite3::getDefaultCertificateNameForKey wrong key"));
 
   string keyId = keyName.get(-1).toUri();
   Name identityName = keyName.getPrefix(-1);
@@ -697,7 +700,7 @@
   }
   else {
     sqlite3_finalize(statement);
-    throw Error("certificate not found");
+    BOOST_THROW_EXCEPTION(Error("certificate not found"));
   }
 }
 
@@ -705,7 +708,7 @@
 SecPublicInfoSqlite3::setDefaultCertificateNameForKeyInternal(const Name& certificateName)
 {
   if (!doesCertificateExist(certificateName))
-    throw Error("certificate does not exist:" + certificateName.toUri());
+    BOOST_THROW_EXCEPTION(Error("certificate does not exist:" + certificateName.toUri()));
 
   Name keyName = IdentityCertificate::certificateNameToPublicKeyName(certificateName);
   string keyId = keyName.get(-1).toUri();
diff --git a/src/security/sec-public-info.cpp b/src/security/sec-public-info.cpp
index 6d9cc4c..2226f51 100644
--- a/src/security/sec-public-info.cpp
+++ b/src/security/sec-public-info.cpp
@@ -78,7 +78,7 @@
     refreshDefaultCertificate();
 
   if (m_defaultCertificate == nullptr)
-    throw Error("No default certificate is set");
+    BOOST_THROW_EXCEPTION(Error("No default certificate is set"));
 
   return m_defaultCertificate->getName();
 }
@@ -98,7 +98,7 @@
   Name keyName = Name(identityName).append(oss.str());
 
   if (doesPublicKeyExist(keyName))
-    throw Error("Key name already exists: " + keyName.toUri());
+    BOOST_THROW_EXCEPTION(Error("Key name already exists: " + keyName.toUri()));
 
   return keyName;
 }
diff --git a/src/security/sec-rule-relative.cpp b/src/security/sec-rule-relative.cpp
index 042d04f..4bf5eb9 100644
--- a/src/security/sec-rule-relative.cpp
+++ b/src/security/sec-rule-relative.cpp
@@ -46,7 +46,7 @@
     m_signerNameRegex(signerRegex, signerExpand)
 {
   if (op != ">" && op != ">=" && op != "==")
-    throw Error("op is wrong!");
+    BOOST_THROW_EXCEPTION(Error("op is wrong"));
 }
 
 SecRuleRelative::~SecRuleRelative()
diff --git a/src/security/sec-tpm-file.cpp b/src/security/sec-tpm-file.cpp
index 4551ce5..e20fa94 100644
--- a/src/security/sec-tpm-file.cpp
+++ b/src/security/sec-tpm-file.cpp
@@ -113,9 +113,9 @@
   string keyURI = keyName.toUri();
 
   if (doesKeyExistInTpm(keyName, KEY_CLASS_PUBLIC))
-    throw Error("public key exists");
+    BOOST_THROW_EXCEPTION(Error("public key exists"));
   if (doesKeyExistInTpm(keyName, KEY_CLASS_PRIVATE))
-    throw Error("private key exists");
+    BOOST_THROW_EXCEPTION(Error("private key exists"));
 
   string keyFileName = m_impl->maintainMapping(keyURI);
 
@@ -194,16 +194,16 @@
             return;
           }
         default:
-          throw Error("Unsupported key type!");
+          BOOST_THROW_EXCEPTION(Error("Unsupported key type"));
         }
     }
   catch (KeyParams::Error& e)
     {
-      throw Error(e.what());
+      BOOST_THROW_EXCEPTION(Error(e.what()));
     }
   catch (CryptoPP::Exception& e)
     {
-      throw Error(e.what());
+      BOOST_THROW_EXCEPTION(Error(e.what()));
     }
 }
 
@@ -226,7 +226,7 @@
   string keyURI = keyName.toUri();
 
   if (!doesKeyExistInTpm(keyName, KEY_CLASS_PUBLIC))
-    throw Error("Public Key does not exist");
+    BOOST_THROW_EXCEPTION(Error("Public Key does not exist"));
 
   ostringstream os;
   try
@@ -238,7 +238,7 @@
     }
   catch (CryptoPP::Exception& e)
     {
-      throw Error(e.what());
+      BOOST_THROW_EXCEPTION(Error(e.what()));
     }
 
   return make_shared<PublicKey>(reinterpret_cast<const uint8_t*>(os.str().c_str()),
@@ -308,7 +308,7 @@
   string keyURI = keyName.toUri();
 
   if (!doesKeyExistInTpm(keyName, KEY_CLASS_PRIVATE))
-    throw Error("private key doesn't exists");
+    BOOST_THROW_EXCEPTION(Error("private key doesn't exist"));
 
   try
     {
@@ -347,7 +347,7 @@
                     return Block(tlv::SignatureValue, os.buf());
                   }
                 default:
-                  throw Error("Unsupported digest algorithm!");
+                  BOOST_THROW_EXCEPTION(Error("Unsupported digest algorithm"));
                 }
             }
         case KEY_TYPE_ECDSA:
@@ -383,16 +383,16 @@
                   return Block(tlv::SignatureValue, sigBuffer);
                 }
               default:
-                throw Error("Unsupported digest algorithm!");
+                BOOST_THROW_EXCEPTION(Error("Unsupported digest algorithm"));
               }
           }
         default:
-          throw Error("Unsupported key type!");
+          BOOST_THROW_EXCEPTION(Error("Unsupported key type"));
         }
     }
   catch (CryptoPP::Exception& e)
     {
-      throw Error(e.what());
+      BOOST_THROW_EXCEPTION(Error(e.what()));
     }
 }
 
@@ -401,7 +401,7 @@
 SecTpmFile::decryptInTpm(const uint8_t* data, size_t dataLength,
                          const Name& keyName, bool isSymmetric)
 {
-  throw Error("SecTpmFile::decryptInTpm is not supported!");
+  BOOST_THROW_EXCEPTION(Error("SecTpmFile::decryptInTpm is not supported"));
   // string keyURI = keyName.toUri();
   // if (!isSymmetric)
   //   {
@@ -463,7 +463,7 @@
 SecTpmFile::encryptInTpm(const uint8_t* data, size_t dataLength,
                          const Name& keyName, bool isSymmetric)
 {
-  throw Error("SecTpmFile::encryptInTpm is not supported!");
+  BOOST_THROW_EXCEPTION(Error("SecTpmFile::encryptInTpm is not supported"));
   // string keyURI = keyName.toUri();
 
   // if (!isSymmetric)
@@ -521,11 +521,10 @@
   //   }
 }
 
-
 void
 SecTpmFile::generateSymmetricKeyInTpm(const Name& keyName, const KeyParams& params)
 {
-  throw Error("SecTpmFile::generateSymmetricKeyInTpm is not supported!");
+  BOOST_THROW_EXCEPTION(Error("SecTpmFile::generateSymmetricKeyInTpm is not supported"));
   // string keyURI = keyName.toUri();
 
   // if (doesKeyExistInTpm(keyName, KEY_CLASS_SYMMETRIC))
diff --git a/src/security/sec-tpm-osx.cpp b/src/security/sec-tpm-osx.cpp
index 4400343..33a2c7f 100644
--- a/src/security/sec-tpm-osx.cpp
+++ b/src/security/sec-tpm-osx.cpp
@@ -250,7 +250,7 @@
   OSStatus res = SecKeychainCopyDefault(&m_impl->m_keyChainRef);
 
   if (res == errSecNoDefaultKeychain) //If no default key chain, create one.
-    throw Error("No default keychain, create one first!");
+    BOOST_THROW_EXCEPTION(Error("No default keychain, please create one first"));
 }
 
 SecTpmOsx::~SecTpmOsx()
@@ -377,7 +377,7 @@
 
   if (doesKeyExistInTpm(keyName, KEY_CLASS_PUBLIC))
     {
-      throw Error("keyName has existed");
+      BOOST_THROW_EXCEPTION(Error("keyName already exists"));
     }
 
   string keyNameUri = m_impl->toInternalKeyName(keyName, KEY_CLASS_PUBLIC);
@@ -410,7 +410,7 @@
         break;
       }
     default:
-      throw Error("Fail to create a key pair: Unsupported key type");
+      BOOST_THROW_EXCEPTION(Error("Fail to create a key pair: Unsupported key type"));
     }
 
   CFReleaser<CFNumberRef> cfKeySize = CFNumberCreate(0, kCFNumberIntType, &keySize);
@@ -434,11 +434,11 @@
       if (unlockTpm(0, 0, false))
         generateKeyPairInTpmInternal(keyName, params, true);
       else
-        throw Error("Fail to unlock the keychain");
+        BOOST_THROW_EXCEPTION(Error("Fail to unlock the keychain"));
     }
   else
     {
-      throw Error("Fail to create a key pair");
+      BOOST_THROW_EXCEPTION(Error("Fail to create a key pair"));
     }
 }
 
@@ -473,7 +473,7 @@
 void
 SecTpmOsx::generateSymmetricKeyInTpm(const Name& keyName, const KeyParams& params)
 {
-  throw Error("SecTpmOsx::generateSymmetricKeyInTpm is not supported");
+  BOOST_THROW_EXCEPTION(Error("SecTpmOsx::generateSymmetricKeyInTpm is not supported"));
   // if (doesKeyExistInTpm(keyName, KEY_CLASS_SYMMETRIC))
   //   throw Error("keyName has existed!");
 
@@ -511,7 +511,8 @@
   CFReleaser<SecKeychainItemRef> publicKey = m_impl->getKey(keyName, KEY_CLASS_PUBLIC);
   if (publicKey.get() == 0)
     {
-      throw Error("Requested public key [" + keyName.toUri() + "] does not exist in OSX Keychain");
+      BOOST_THROW_EXCEPTION(Error("Requested public key [" + keyName.toUri() + "] does not exist "
+                                  "in OSX Keychain"));
     }
 
   CFReleaser<CFDataRef> exportedKey;
@@ -522,7 +523,7 @@
                                &exportedKey.get());
   if (res != errSecSuccess)
     {
-      throw Error("Cannot export requested public key from OSX Keychain");
+      BOOST_THROW_EXCEPTION(Error("Cannot export requested public key from OSX Keychain"));
     }
 
   shared_ptr<PublicKey> key = make_shared<PublicKey>(CFDataGetBytePtr(exportedKey.get()),
@@ -545,7 +546,8 @@
   if (privateKey.get() == 0)
     {
       /// @todo Can this happen because of keychain is locked?
-      throw Error("Private key [" + keyName.toUri() + "] does not exist in OSX Keychain");
+      BOOST_THROW_EXCEPTION(Error("Private key [" + keyName.toUri() + "] does not exist "
+                                  "in OSX Keychain"));
     }
 
   shared_ptr<PublicKey> publicKey = getPublicKeyFromTpm(keyName);
@@ -597,8 +599,8 @@
       break;
     }
   default:
-    throw Error("Unsupported key type" +
-                boost::lexical_cast<std::string>(publicKey->getKeyType()));
+    BOOST_THROW_EXCEPTION(Error("Unsupported key type" +
+                                boost::lexical_cast<std::string>(publicKey->getKeyType())));
   }
 
   OBufferStream pkcs8Os;
@@ -813,7 +815,8 @@
   CFReleaser<SecKeychainItemRef> privateKey = m_impl->getKey(keyName, KEY_CLASS_PRIVATE);
   if (privateKey.get() == 0)
     {
-      throw Error("Private key [" + keyName.toUri() + "] does not exist in OSX Keychain");
+      BOOST_THROW_EXCEPTION(Error("Private key [" + keyName.toUri() + "] does not exist "
+                                  "in OSX Keychain"));
     }
 
   CFReleaser<CFErrorRef> error;
@@ -821,7 +824,7 @@
   CFReleaser<SecTransformRef> signer = SecSignTransformCreate((SecKeyRef)privateKey.get(),
                                                               &error.get());
   if (error.get() != 0)
-    throw Error("Fail to create signer");
+    BOOST_THROW_EXCEPTION(Error("Fail to create signer"));
 
   // Set input
   SecTransformSetAttribute(signer.get(),
@@ -829,7 +832,7 @@
                            dataRef.get(),
                            &error.get());
   if (error.get() != 0)
-    throw Error("Fail to configure input of signer");
+    BOOST_THROW_EXCEPTION(Error("Fail to configure input of signer"));
 
   // Enable use of padding
   SecTransformSetAttribute(signer.get(),
@@ -837,7 +840,7 @@
                            kSecPaddingPKCS1Key,
                            &error.get());
   if (error.get() != 0)
-    throw Error("Fail to configure digest algorithm of signer");
+    BOOST_THROW_EXCEPTION(Error("Fail to configure digest algorithm of signer"));
 
   // Set padding type
   SecTransformSetAttribute(signer.get(),
@@ -845,7 +848,7 @@
                            m_impl->getDigestAlgorithm(digestAlgorithm),
                            &error.get());
   if (error.get() != 0)
-    throw Error("Fail to configure digest algorithm of signer");
+    BOOST_THROW_EXCEPTION(Error("Fail to configure digest algorithm of signer"));
 
   // Set padding attribute
   long digestSize = m_impl->getDigestSize(digestAlgorithm);
@@ -855,7 +858,7 @@
                            cfDigestSize.get(),
                            &error.get());
   if (error.get() != 0)
-    throw Error("Fail to configure digest size of signer");
+    BOOST_THROW_EXCEPTION(Error("Fail to configure digest size of signer"));
 
   // Actually sign
   // C-style cast is used as per Apple convention
@@ -867,17 +870,17 @@
           if (unlockTpm(0, 0, false))
             return signInTpmInternal(data, dataLength, keyName, digestAlgorithm, true);
           else
-            throw Error("Fail to unlock the keychain");
+            BOOST_THROW_EXCEPTION(Error("Fail to unlock the keychain"));
         }
       else
         {
           CFShow(error.get());
-          throw Error("Fail to sign data");
+          BOOST_THROW_EXCEPTION(Error("Fail to sign data"));
         }
     }
 
   if (signature.get() == 0)
-    throw Error("Signature is NULL!\n");
+    BOOST_THROW_EXCEPTION(Error("Signature is NULL!\n"));
 
   return Block(tlv::SignatureValue,
                make_shared<Buffer>(CFDataGetBytePtr(signature.get()),
@@ -887,7 +890,7 @@
 ConstBufferPtr
 SecTpmOsx::decryptInTpm(const uint8_t* data, size_t dataLength, const Name& keyName, bool sym)
 {
-  throw Error("SecTpmOsx::decryptInTpm is not supported");
+  BOOST_THROW_EXCEPTION(Error("SecTpmOsx::decryptInTpm is not supported"));
 
   // KeyClass keyClass;
   // if (sym)
@@ -936,7 +939,8 @@
       CFReleaser<SecKeychainItemRef> privateKey = m_impl->getKey(keyName, keyClass);
       if (privateKey.get() == 0)
         {
-          throw Error("Private key [" + keyName.toUri() + "] does not exist in OSX Keychain");
+          BOOST_THROW_EXCEPTION(Error("Private key [" + keyName.toUri() + "] does not exist "
+                                      "in OSX Keychain"));
         }
 
       CFReleaser<SecAccessRef> accRef;
@@ -978,7 +982,7 @@
 ConstBufferPtr
 SecTpmOsx::encryptInTpm(const uint8_t* data, size_t dataLength, const Name& keyName, bool sym)
 {
-  throw Error("SecTpmOsx::encryptInTpm is not supported");
+  BOOST_THROW_EXCEPTION(Error("SecTpmOsx::encryptInTpm is not supported"));
 
   // KeyClass keyClass;
   // if (sym)
diff --git a/src/security/sec-tpm.cpp b/src/security/sec-tpm.cpp
index 5c12049..c84b2de 100644
--- a/src/security/sec-tpm.cpp
+++ b/src/security/sec-tpm.cpp
@@ -57,7 +57,7 @@
 
   // derive key
   if (!generateRandomBlock(salt, 8) || !generateRandomBlock(iv, 8))
-    throw Error("Cannot generate salt or iv");
+    BOOST_THROW_EXCEPTION(Error("Cannot generate salt or iv"));
 
   uint32_t iterationCount = 2048;
 
@@ -74,7 +74,7 @@
     }
   catch (CryptoPP::Exception& e)
     {
-      throw Error("Cannot derived the encryption key");
+      BOOST_THROW_EXCEPTION(Error("Cannot derived the encryption key"));
     }
 
   //encrypt
@@ -84,7 +84,7 @@
   ConstBufferPtr pkcs8PrivateKey = exportPrivateKeyPkcs8FromTpm(keyName);
 
   if (!static_cast<bool>(pkcs8PrivateKey))
-    throw Error("Cannot export the private key, #1");
+    BOOST_THROW_EXCEPTION(Error("Cannot export the private key, #1"));
 
   OBufferStream encryptedOs;
   try
@@ -94,7 +94,7 @@
     }
   catch (CryptoPP::Exception& e)
     {
-      throw Error("Cannot export the private key, #2");
+      BOOST_THROW_EXCEPTION(Error("Cannot export the private key, #2"));
     }
 
   //encode
@@ -166,7 +166,7 @@
     }
   catch (CryptoPP::Exception& e)
     {
-      throw Error("Cannot export the private key, #3");
+      BOOST_THROW_EXCEPTION(Error("Cannot export the private key, #3"));
     }
 }
 
diff --git a/src/security/signature-sha256-with-ecdsa.cpp b/src/security/signature-sha256-with-ecdsa.cpp
index 642912b..7de71a2 100644
--- a/src/security/signature-sha256-with-ecdsa.cpp
+++ b/src/security/signature-sha256-with-ecdsa.cpp
@@ -32,17 +32,17 @@
   : Signature(signature)
 {
   if (getType() != tlv::SignatureSha256WithEcdsa)
-    throw Error("Incorrect signature type");
+    BOOST_THROW_EXCEPTION(Error("Incorrect signature type"));
 
   if (!hasKeyLocator()) {
-    throw Error("KeyLocator is missing");
+    BOOST_THROW_EXCEPTION(Error("KeyLocator is missing"));
   }
 }
 
 void
 SignatureSha256WithEcdsa::unsetKeyLocator()
 {
-  throw Error("KeyLocator cannot be reset for SignatureSha256WithEcdsa");
+  BOOST_THROW_EXCEPTION(Error("KeyLocator cannot be reset for SignatureSha256WithEcdsa"));
 }
 
 } // namespace ndn
diff --git a/src/security/signature-sha256-with-rsa.cpp b/src/security/signature-sha256-with-rsa.cpp
index cda06e6..572257d 100644
--- a/src/security/signature-sha256-with-rsa.cpp
+++ b/src/security/signature-sha256-with-rsa.cpp
@@ -32,17 +32,17 @@
   : Signature(signature)
 {
   if (getType() != tlv::SignatureSha256WithRsa)
-    throw Error("Incorrect signature type");
+    BOOST_THROW_EXCEPTION(Error("Incorrect signature type"));
 
   if (!hasKeyLocator()) {
-    throw Error("KeyLocator is missing");
+    BOOST_THROW_EXCEPTION(Error("KeyLocator is missing"));
   }
 }
 
 void
 SignatureSha256WithRsa::unsetKeyLocator()
 {
-  throw Error("KeyLocator cannot be reset for SignatureSha256WithRsa");
+  BOOST_THROW_EXCEPTION(Error("KeyLocator cannot be reset for SignatureSha256WithRsa"));
 }
 
 } // namespace ndn
diff --git a/src/security/validator-config.cpp b/src/security/validator-config.cpp
index 149c5dc..c9dbf4d 100644
--- a/src/security/validator-config.cpp
+++ b/src/security/validator-config.cpp
@@ -82,7 +82,7 @@
     {
       std::string msg = "Failed to read configuration file: ";
       msg += filename;
-      throw security::conf::Error(msg);
+      BOOST_THROW_EXCEPTION(security::conf::Error(msg));
     }
   load(inputFile, filename);
   inputFile.close();
@@ -110,7 +110,7 @@
       msg << "Failed to parse configuration file";
       msg << " " << filename;
       msg << " " << error.message() << " line " << error.line();
-      throw security::conf::Error(msg.str());
+      BOOST_THROW_EXCEPTION(security::conf::Error(msg.str()));
     }
 
   load(tree, filename);
@@ -130,7 +130,7 @@
       msg += ": ";
       msg += filename;
       msg += " no data";
-      throw security::conf::Error(msg);
+      BOOST_THROW_EXCEPTION(security::conf::Error(msg));
     }
 
   for (security::conf::ConfigSection::const_iterator i = configSection.begin();
@@ -153,7 +153,7 @@
           msg += " ";
           msg += filename;
           msg += " unrecognized section: " + sectionName;
-          throw security::conf::Error(msg);
+          BOOST_THROW_EXCEPTION(security::conf::Error(msg));
         }
     }
 }
@@ -168,14 +168,14 @@
 
   // Get rule.id
   if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "id"))
-    throw Error("Expect <rule.id>!");
+    BOOST_THROW_EXCEPTION(Error("Expect <rule.id>!"));
 
   std::string ruleId = propertyIt->second.data();
   propertyIt++;
 
   // Get rule.for
   if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first,"for"))
-    throw Error("Expect <rule.for> in rule: " + ruleId + "!");
+    BOOST_THROW_EXCEPTION(Error("Expect <rule.for> in rule: " + ruleId + "!"));
 
   std::string usage = propertyIt->second.data();
   propertyIt++;
@@ -186,8 +186,8 @@
   else if (boost::iequals(usage, "interest"))
     isForData = false;
   else
-    throw Error("Unrecognized <rule.for>: " + usage
-                + " in rule: " + ruleId);
+    BOOST_THROW_EXCEPTION(Error("Unrecognized <rule.for>: " + usage
+                                + " in rule: " + ruleId));
 
   // Get rule.filter(s)
   std::vector<shared_ptr<Filter> > filters;
@@ -197,7 +197,7 @@
         {
           if (boost::iequals(propertyIt->first, "checker"))
             break;
-          throw Error("Expect <rule.filter> in rule: " + ruleId);
+          BOOST_THROW_EXCEPTION(Error("Expect <rule.filter> in rule: " + ruleId));
         }
 
       filters.push_back(FilterFactory::create(propertyIt->second));
@@ -209,7 +209,7 @@
   for (; propertyIt != configSection.end(); propertyIt++)
     {
       if (!boost::iequals(propertyIt->first, "checker"))
-        throw Error("Expect <rule.checker> in rule: " + ruleId);
+        BOOST_THROW_EXCEPTION(Error("Expect <rule.checker> in rule: " + ruleId));
 
       checkers.push_back(CheckerFactory::create(propertyIt->second, filename));
       continue;
@@ -217,10 +217,10 @@
 
   // Check other stuff
   if (propertyIt != configSection.end())
-    throw Error("Expect the end of rule: " + ruleId);
+    BOOST_THROW_EXCEPTION(Error("Expect the end of rule: " + ruleId));
 
   if (checkers.size() == 0)
-    throw Error("No <rule.checker> is specified in rule: " + ruleId);
+    BOOST_THROW_EXCEPTION(Error("No <rule.checker> is specified in rule: " + ruleId));
 
   if (isForData)
     {
@@ -255,7 +255,7 @@
 
   // Get trust-anchor.type
   if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "type"))
-    throw Error("Expect <trust-anchor.type>!");
+    BOOST_THROW_EXCEPTION(Error("Expect <trust-anchor.type>!"));
 
   std::string type = propertyIt->second.data();
   propertyIt++;
@@ -264,14 +264,14 @@
     {
       // Get trust-anchor.file
       if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first,"file-name"))
-        throw Error("Expect <trust-anchor.file-name>!");
+        BOOST_THROW_EXCEPTION(Error("Expect <trust-anchor.file-name>!"));
 
       std::string file = propertyIt->second.data();
       propertyIt++;
 
       // Check other stuff
       if (propertyIt != configSection.end())
-        throw Error("Expect the end of trust-anchor!");
+        BOOST_THROW_EXCEPTION(Error("Expect the end of trust-anchor!"));
 
       path certfilePath = absolute(file, path(filename).parent_path());
       shared_ptr<IdentityCertificate> idCert =
@@ -284,8 +284,8 @@
           m_anchors[idCert->getName().getPrefix(-1)] = idCert;
         }
       else
-        throw Error("Cannot read certificate from file: " +
-                    certfilePath.native());
+        BOOST_THROW_EXCEPTION(Error("Cannot read certificate from file: " +
+                                    certfilePath.native()));
 
       return;
     }
@@ -293,14 +293,14 @@
     {
       // Get trust-anchor.base64-string
       if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "base64-string"))
-        throw Error("Expect <trust-anchor.base64-string>!");
+        BOOST_THROW_EXCEPTION(Error("Expect <trust-anchor.base64-string>!"));
 
       std::stringstream ss(propertyIt->second.data());
       propertyIt++;
 
       // Check other stuff
       if (propertyIt != configSection.end())
-        throw Error("Expect the end of trust-anchor!");
+        BOOST_THROW_EXCEPTION(Error("Expect the end of trust-anchor!"));
 
       shared_ptr<IdentityCertificate> idCert = io::load<IdentityCertificate>(ss);
 
@@ -311,14 +311,14 @@
           m_anchors[idCert->getName().getPrefix(-1)] = idCert;
         }
       else
-        throw Error("Cannot decode certificate from base64-string");
+        BOOST_THROW_EXCEPTION(Error("Cannot decode certificate from base64-string"));
 
       return;
     }
   else if (boost::iequals(type, "dir"))
     {
       if (propertyIt == configSection.end() || !boost::iequals(propertyIt->first, "dir"))
-        throw Error("Expect <trust-anchor.dir>!");
+        BOOST_THROW_EXCEPTION(Error("Expect <trust-anchor.dir>"));
 
       std::string dirString(propertyIt->second.data());
       propertyIt++;
@@ -333,7 +333,7 @@
               propertyIt++;
 
               if (propertyIt != configSection.end())
-                throw Error("Expect the end of trust-anchor!");
+                BOOST_THROW_EXCEPTION(Error("Expect the end of trust-anchor"));
 
               path dirPath = absolute(dirString, path(filename).parent_path());
 
@@ -344,7 +344,7 @@
               return;
             }
           else
-            throw Error("Expect <trust-anchor.refresh>!");
+            BOOST_THROW_EXCEPTION(Error("Expect <trust-anchor.refresh>!"));
         }
       else
         {
@@ -371,7 +371,7 @@
       m_shouldValidate = false;
     }
   else
-    throw Error("Unsupported trust-anchor.type: " + type);
+    BOOST_THROW_EXCEPTION(Error("Unsupported trust-anchor.type: " + type));
 }
 
 void
@@ -414,7 +414,7 @@
     }
   catch (boost::bad_lexical_cast&)
     {
-      throw Error("Bad number: " + refreshString);
+      BOOST_THROW_EXCEPTION(Error("Bad number: " + refreshString));
     }
 
   if (number == 0)
@@ -429,7 +429,7 @@
     case 's':
       return time::duration_cast<time::nanoseconds>(time::seconds(number));
     default:
-      throw Error(std::string("Wrong time unit: ") + unit);
+      BOOST_THROW_EXCEPTION(Error(std::string("Wrong time unit: ") + unit));
     }
 }
 
diff --git a/src/security/validity-period.cpp b/src/security/validity-period.cpp
index 008cd3c..c6f6026 100644
--- a/src/security/validity-period.cpp
+++ b/src/security/validity-period.cpp
@@ -94,23 +94,23 @@
 ValidityPeriod::wireDecode(const Block& wire)
 {
   if (!wire.hasWire()) {
-    throw Error("The supplied block does not contain wire format");
+    BOOST_THROW_EXCEPTION(Error("The supplied block does not contain wire format"));
   }
 
   m_wire = wire;
   m_wire.parse();
 
   if (m_wire.type() != tlv::ValidityPeriod)
-    throw Error("Unexpected TLV type when decoding ValidityPeriod");
+    BOOST_THROW_EXCEPTION(Error("Unexpected TLV type when decoding ValidityPeriod"));
 
   if (m_wire.elements_size() != 2)
-    throw Error("Does not have two sub-TLVs");
+    BOOST_THROW_EXCEPTION(Error("Does not have two sub-TLVs"));
 
   if (m_wire.elements()[NOT_BEFORE_OFFSET].type() != tlv::NotBefore ||
       m_wire.elements()[NOT_BEFORE_OFFSET].value_size() != ISO_DATETIME_SIZE ||
       m_wire.elements()[NOT_AFTER_OFFSET].type() != tlv::NotAfter ||
       m_wire.elements()[NOT_AFTER_OFFSET].value_size() != ISO_DATETIME_SIZE) {
-    throw Error("Invalid NotBefore or NotAfter field");
+    BOOST_THROW_EXCEPTION(Error("Invalid NotBefore or NotAfter field"));
   }
 
   try {
@@ -120,7 +120,7 @@
                    time::fromIsoString(readString(m_wire.elements()[NOT_AFTER_OFFSET])));
   }
   catch (const std::bad_cast&) {
-    throw Error("Invalid date format in NOT-BEFORE or NOT-AFTER field");
+    BOOST_THROW_EXCEPTION(Error("Invalid date format in NOT-BEFORE or NOT-AFTER field"));
   }
 }
 
diff --git a/src/selectors.cpp b/src/selectors.cpp
index 6e637fa..7b46b1e 100644
--- a/src/selectors.cpp
+++ b/src/selectors.cpp
@@ -135,7 +135,7 @@
 Selectors::wireDecode(const Block& wire)
 {
   if (wire.type() != tlv::Selectors)
-    throw tlv::Error("Unexpected TLV type when decoding Selectors");
+    BOOST_THROW_EXCEPTION(tlv::Error("Unexpected TLV type when decoding Selectors"));
 
   *this = Selectors();
 
diff --git a/src/signature-info.cpp b/src/signature-info.cpp
index e48482e..d96aab3 100644
--- a/src/signature-info.cpp
+++ b/src/signature-info.cpp
@@ -87,7 +87,7 @@
   if (m_hasKeyLocator)
     return m_keyLocator;
   else
-    throw Error("KeyLocator does not exist");
+    BOOST_THROW_EXCEPTION(Error("KeyLocator does not exist"));
 }
 
 void
@@ -110,7 +110,7 @@
 SignatureInfo::getValidityPeriod() const
 {
   if (m_otherTlvs.empty() || m_otherTlvs.front().type() != tlv::ValidityPeriod) {
-    throw Error("SignatureInfo does not contain the requested ValidityPeriod field");
+    BOOST_THROW_EXCEPTION(Error("SignatureInfo does not contain the requested ValidityPeriod field"));
   }
 
   return security::ValidityPeriod(m_otherTlvs.front());
@@ -132,8 +132,8 @@
       return *i;
   }
 
-  throw Error("(SignatureInfo::getTypeSpecificTlv) Requested a non-existed type [" +
-              boost::lexical_cast<std::string>(type) + "] from SignatureInfo");
+  BOOST_THROW_EXCEPTION(Error("(SignatureInfo::getTypeSpecificTlv) Requested a non-existed type [" +
+                              boost::lexical_cast<std::string>(type) + "] from SignatureInfo"));
 }
 
 template<encoding::Tag TAG>
@@ -184,7 +184,7 @@
 SignatureInfo::wireDecode(const Block& wire)
 {
   if (!wire.hasWire()) {
-    throw Error("The supplied block does not contain wire format");
+    BOOST_THROW_EXCEPTION(Error("The supplied block does not contain wire format"));
   }
 
   m_hasKeyLocator = false;
@@ -193,7 +193,7 @@
   m_wire.parse();
 
   if (m_wire.type() != tlv::SignatureInfo)
-    throw tlv::Error("Unexpected TLV type when decoding Name");
+    BOOST_THROW_EXCEPTION(tlv::Error("Unexpected TLV type when decoding Name"));
 
   Block::element_const_iterator it = m_wire.elements_begin();
 
@@ -203,7 +203,8 @@
     it++;
   }
   else
-    throw Error("SignatureInfo does not have sub-TLV or the first sub-TLV is not SignatureType");
+    BOOST_THROW_EXCEPTION(Error("SignatureInfo does not have sub-TLV or the first sub-TLV is not "
+                                "SignatureType"));
 
   // the second block could be KeyLocator
   if (it != m_wire.elements_end() && it->type() == tlv::KeyLocator) {
diff --git a/src/signature.cpp b/src/signature.cpp
index 2152dd0..10b2218 100644
--- a/src/signature.cpp
+++ b/src/signature.cpp
@@ -50,7 +50,7 @@
 Signature::setValue(const Block& value)
 {
   if (value.type() != tlv::SignatureValue) {
-    throw Error("The supplied block is not SignatureValue");
+    BOOST_THROW_EXCEPTION(Error("The supplied block is not SignatureValue"));
   }
   m_value = value;
 }
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,
diff --git a/src/transport/tcp-transport.cpp b/src/transport/tcp-transport.cpp
index c43790f..afde1e0 100644
--- a/src/transport/tcp-transport.cpp
+++ b/src/transport/tcp-transport.cpp
@@ -57,8 +57,8 @@
 
     const std::string scheme = uri.getScheme();
     if (scheme != "tcp" && scheme != "tcp4" && scheme != "tcp6") {
-      throw Transport::Error("Cannot create TcpTransport from \"" +
-                             scheme + "\" URI");
+      BOOST_THROW_EXCEPTION(Transport::Error("Cannot create TcpTransport from \"" +
+                                             scheme + "\" URI"));
     }
 
     if (!uri.getHost().empty()) {
@@ -70,7 +70,7 @@
     }
   }
   catch (const util::FaceUri::Error& error) {
-    throw ConfigFile::Error(error.what());
+    BOOST_THROW_EXCEPTION(ConfigFile::Error(error.what()));
   }
 
   return {host, port};
diff --git a/src/transport/unix-transport.cpp b/src/transport/unix-transport.cpp
index df505d7..3464d79 100644
--- a/src/transport/unix-transport.cpp
+++ b/src/transport/unix-transport.cpp
@@ -49,8 +49,8 @@
 
       if (uri.getScheme() != "unix")
         {
-          throw Transport::Error("Cannot create UnixTransport from \"" +
-                                 uri.getScheme() + "\" URI");
+          BOOST_THROW_EXCEPTION(Transport::Error("Cannot create UnixTransport from \"" +
+                                                 uri.getScheme() + "\" URI"));
         }
 
       if (!uri.getPath().empty())
@@ -64,11 +64,11 @@
     }
   catch (const boost::property_tree::ptree_bad_data& error)
     {
-      throw ConfigFile::Error(error.what());
+      BOOST_THROW_EXCEPTION(ConfigFile::Error(error.what()));
     }
   catch (const util::FaceUri::Error& error)
     {
-      throw ConfigFile::Error(error.what());
+      BOOST_THROW_EXCEPTION(ConfigFile::Error(error.what()));
     }
 
   // Assume the default nfd.sock location.
diff --git a/src/util/config-file.cpp b/src/util/config-file.cpp
index a68939d..ebf2a7a 100644
--- a/src/util/config-file.cpp
+++ b/src/util/config-file.cpp
@@ -123,11 +123,11 @@
 {
   if (m_path.empty())
     {
-      throw Error("Failed to locate configuration file for parsing");
+      BOOST_THROW_EXCEPTION(Error("Failed to locate configuration file for parsing"));
     }
   else if (!m_input.is_open() && !open())
     {
-      throw Error("Failed to open configuration file for parsing");
+      BOOST_THROW_EXCEPTION(Error("Failed to open configuration file for parsing"));
     }
 
   try
@@ -140,7 +140,7 @@
       msg << "Failed to parse configuration file";
       msg << " " << m_path;
       msg << " " << error.message() << " line " << error.line();
-      throw Error(msg.str());
+      BOOST_THROW_EXCEPTION(Error(msg.str()));
     }
   return m_config;
 }
diff --git a/src/util/digest.cpp b/src/util/digest.cpp
index d5bb312..23af4c9 100644
--- a/src/util/digest.cpp
+++ b/src/util/digest.cpp
@@ -126,7 +126,7 @@
 {
   // cannot update Digest when it has been finalized
   if (m_isFinalized)
-    throw Error("Digest has been already finalized");
+    BOOST_THROW_EXCEPTION(Error("Digest has been already finalized"));
 
   m_hash.Update(buffer, size);
 
diff --git a/src/util/dns.cpp b/src/util/dns.cpp
index 03bf9f9..7c992ff 100644
--- a/src/util/dns.cpp
+++ b/src/util/dns.cpp
@@ -151,7 +151,7 @@
           return EndPoint(*remoteEndpoint).address();
         }
     }
-  throw Error("No endpoint matching the specified address selector found");
+  BOOST_THROW_EXCEPTION(Error("No endpoint matching the specified address selector found"));
 }
 
 } // namespace dns
diff --git a/src/util/face-uri.cpp b/src/util/face-uri.cpp
index ff5669b..f23ae8c 100644
--- a/src/util/face-uri.cpp
+++ b/src/util/face-uri.cpp
@@ -48,14 +48,14 @@
 FaceUri::FaceUri(const std::string& uri)
 {
   if (!parse(uri)) {
-    throw Error("Malformed URI: " + uri);
+    BOOST_THROW_EXCEPTION(Error("Malformed URI: " + uri));
   }
 }
 
 FaceUri::FaceUri(const char* uri)
 {
   if (!parse(uri)) {
-    throw Error("Malformed URI: " + std::string(uri));
+    BOOST_THROW_EXCEPTION(Error("Malformed URI: " + std::string(uri)));
   }
 }
 
diff --git a/src/util/in-memory-storage.cpp b/src/util/in-memory-storage.cpp
index 9c3146f..5001e97 100644
--- a/src/util/in-memory-storage.cpp
+++ b/src/util/in-memory-storage.cpp
@@ -125,7 +125,7 @@
     ssize_t nAllowedFailures = size() - m_capacity;
     while (size() > m_capacity) {
       if (!evictItem() && --nAllowedFailures < 0) {
-        throw Error();
+        BOOST_THROW_EXCEPTION(Error());
       }
     }
   }
diff --git a/src/util/io.hpp b/src/util/io.hpp
index f49d712..f751bc6 100644
--- a/src/util/io.hpp
+++ b/src/util/io.hpp
@@ -148,15 +148,15 @@
     }
   catch (TypeError& e)
     {
-      throw Error(e.what());
+      BOOST_THROW_EXCEPTION(Error(e.what()));
     }
   catch (CryptoPP::Exception& e)
     {
-      throw Error(e.what());
+      BOOST_THROW_EXCEPTION(Error(e.what()));
     }
   catch (tlv::Error& e)
     {
-      throw Error(e.what());
+      BOOST_THROW_EXCEPTION(Error(e.what()));
     }
 }
 
diff --git a/src/util/network-monitor.cpp b/src/util/network-monitor.cpp
index 5513d0d..8f7b1f9 100644
--- a/src/util/network-monitor.cpp
+++ b/src/util/network-monitor.cpp
@@ -165,7 +165,8 @@
   {
     int fd = ::socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
     if (fd < 0)
-      throw Error(std::string("Cannot create netlink socket (") + std::strerror(errno) + ")");
+      BOOST_THROW_EXCEPTION(Error(std::string("Cannot create netlink socket (") +
+                                  std::strerror(errno) + ")"));
 
     sockaddr_nl addr{};
     addr.nl_family = AF_NETLINK;
@@ -174,7 +175,8 @@
       RTMGRP_IPV6_IFADDR | RTMGRP_IPV6_ROUTE;
 
     if (::bind(fd, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) == -1) {
-      throw Error(std::string("Cannot bind on netlink socket (") + std::strerror(errno) + ")");
+      BOOST_THROW_EXCEPTION(Error(std::string("Cannot bind on netlink socket (") +
+                                  std::strerror(errno) + ")"));
     }
 
     m_socket.assign(fd);
@@ -239,7 +241,7 @@
 
 NetworkMonitor::NetworkMonitor(boost::asio::io_service&)
 {
-  throw Error("Network monitoring is not supported on this platform");
+  BOOST_THROW_EXCEPTION(Error("Network monitoring is not supported on this platform"));
 }
 
 NetworkMonitor::~NetworkMonitor()
diff --git a/src/util/regex/regex-backref-matcher.hpp b/src/util/regex/regex-backref-matcher.hpp
index 1174541..77efd83 100644
--- a/src/util/regex/regex-backref-matcher.hpp
+++ b/src/util/regex/regex-backref-matcher.hpp
@@ -69,7 +69,7 @@
 RegexBackrefMatcher::compile()
 {
   if (m_expr.size() < 2)
-    throw RegexMatcher::Error("Unrecognized format: " + m_expr);
+    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Unrecognized format: " + m_expr));
 
   size_t lastIndex = m_expr.size() - 1;
   if ('(' == m_expr[0] && ')' == m_expr[lastIndex]) {
@@ -80,7 +80,7 @@
     m_matchers.push_back(matcher);
   }
   else
-    throw RegexMatcher::Error("Unrecognized format: " + m_expr);
+    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Unrecognized format: " + m_expr));
 }
 
 
diff --git a/src/util/regex/regex-component-matcher.hpp b/src/util/regex/regex-component-matcher.hpp
index 6b5474a..029bb03 100644
--- a/src/util/regex/regex-component-matcher.hpp
+++ b/src/util/regex/regex-component-matcher.hpp
@@ -136,7 +136,8 @@
     }
   else
     {
-      throw RegexMatcher::Error("Non-exact component search is not supported yet!");
+      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Non-exact component search is not supported "
+                                                "yet"));
     }
 
   return false;
diff --git a/src/util/regex/regex-component-set-matcher.hpp b/src/util/regex/regex-component-set-matcher.hpp
index 9c2ff16..b20ad44 100644
--- a/src/util/regex/regex-component-set-matcher.hpp
+++ b/src/util/regex/regex-component-set-matcher.hpp
@@ -92,7 +92,8 @@
 RegexComponentSetMatcher::compile()
 {
   if (m_expr.size() < 2)
-    throw RegexMatcher::Error("Regexp compile error (cannot parse " + m_expr + ")");
+    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Regexp compile error (cannot parse " +
+                                              m_expr + ")"));
 
   switch (m_expr[0]) {
   case '<':
@@ -101,7 +102,8 @@
     {
       size_t lastIndex = m_expr.size() - 1;
       if (']' != m_expr[lastIndex])
-        throw RegexMatcher::Error("Regexp compile error (no matching ']' in " + m_expr + ")");
+        BOOST_THROW_EXCEPTION(RegexMatcher::Error("Regexp compile error (no matching ']' in " +
+                                                  m_expr + ")"));
 
       if ('^' == m_expr[1]) {
         m_isInclusion = false;
@@ -112,7 +114,8 @@
       break;
     }
   default:
-    throw RegexMatcher::Error("Regexp compile error (cannot parse " + m_expr + ")");
+    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Regexp compile error (cannot parse " +
+                                              m_expr + ")"));
   }
 }
 
@@ -123,7 +126,7 @@
 
   if (m_expr.size() != end)
     {
-      throw RegexMatcher::Error("Component expr error " + m_expr);
+      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Component expr error " + m_expr));
     }
   else
     {
@@ -142,7 +145,7 @@
 
   while (index < lastIndex) {
     if ('<' != m_expr[index])
-      throw RegexMatcher::Error("Component expr error " + m_expr);
+      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Component expr error " + m_expr));
 
     tempIndex = index + 1;
     index = extractComponent(tempIndex);
@@ -155,7 +158,7 @@
   }
 
   if (index != lastIndex)
-    throw RegexMatcher::Error("Not sufficient expr to parse " + m_expr);
+    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Not sufficient expr to parse " + m_expr));
 }
 
 inline bool
@@ -208,7 +211,7 @@
       break;
 
     case 0:
-      throw RegexMatcher::Error("Error: square brackets mismatch");
+      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Error: square brackets mismatch"));
       break;
     }
     index++;
diff --git a/src/util/regex/regex-pattern-list-matcher.hpp b/src/util/regex/regex-pattern-list-matcher.hpp
index acca0f9..fedcbaa 100644
--- a/src/util/regex/regex-pattern-list-matcher.hpp
+++ b/src/util/regex/regex-pattern-list-matcher.hpp
@@ -86,7 +86,7 @@
     subHead = index;
 
     if (!extractPattern(subHead, &index))
-      throw RegexMatcher::Error("Compile error");
+      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Compile error"));
   }
 }
 
@@ -135,7 +135,7 @@
     break;
 
   default:
-    throw RegexMatcher::Error("Unexpected syntax");
+    BOOST_THROW_EXCEPTION(RegexMatcher::Error("Unexpected syntax"));
   }
 
   *next = end;
@@ -152,7 +152,7 @@
   while (lcount > rcount) {
 
     if (index >= m_expr.size())
-      throw RegexMatcher::Error("Parenthesis mismatch");
+      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Parenthesis mismatch"));
 
     if (left == m_expr[index])
       lcount++;
@@ -184,7 +184,7 @@
         break;
     }
     if (index == exprSize)
-      throw RegexMatcher::Error("Missing right brace bracket");
+      BOOST_THROW_EXCEPTION(RegexMatcher::Error("Missing right brace bracket"));
     else
       return ++index;
   }
diff --git a/src/util/regex/regex-repeat-matcher.hpp b/src/util/regex/regex-repeat-matcher.hpp
index 3d6e4f5..530721e 100644
--- a/src/util/regex/regex-repeat-matcher.hpp
+++ b/src/util/regex/regex-repeat-matcher.hpp
@@ -162,12 +162,12 @@
         max = min;
       }
       else
-        throw RegexMatcher::Error(std::string("Error: RegexRepeatMatcher.ParseRepetition(): ")
-                                  + "Unrecognized format "+ m_expr);
+        BOOST_THROW_EXCEPTION(RegexMatcher::Error(std::string("Error: RegexRepeatMatcher.ParseRepetition():")
+                                                  + " Unrecognized format "+ m_expr));
 
       if (min > MAX_REPETITIONS || max > MAX_REPETITIONS || min > max)
-        throw RegexMatcher::Error(std::string("Error: RegexRepeatMatcher.ParseRepetition(): ")
-                                  + "Wrong number " + m_expr);
+        BOOST_THROW_EXCEPTION(RegexMatcher::Error(std::string("Error: RegexRepeatMatcher.ParseRepetition():")
+                                                  + " Wrong number " + m_expr));
 
       m_repeatMin = min;
       m_repeatMax = max;
diff --git a/src/util/regex/regex-top-matcher.cpp b/src/util/regex/regex-top-matcher.cpp
index 5ed4937..30b755f 100644
--- a/src/util/regex/regex-top-matcher.cpp
+++ b/src/util/regex/regex-top-matcher.cpp
@@ -146,7 +146,7 @@
                 result.append(*it);
             }
           else
-            throw RegexMatcher::Error("Exceed the range of back reference");
+            BOOST_THROW_EXCEPTION(RegexMatcher::Error("Exceed the range of back reference"));
         }
     }
   return result;
@@ -161,23 +161,23 @@
     {
       offset++;
       if (offset >= expand.size())
-        throw RegexMatcher::Error("wrong format of expand string!");
+        BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
 
       while (expand[offset] <= '9' and expand[offset] >= '0') {
         offset++;
         if (offset > expand.size())
-          throw RegexMatcher::Error("wrong format of expand string!");
+          BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
       }
       if (offset > begin + 1)
         return expand.substr(begin, offset - begin);
       else
-        throw RegexMatcher::Error("wrong format of expand string!");
+        BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
     }
   else if (expand[offset] == '<')
     {
       offset++;
       if (offset >= expand.size())
-        throw RegexMatcher::Error("wrong format of expand string!");
+        BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
 
       size_t left = 1;
       size_t right = 0;
@@ -189,12 +189,12 @@
             right++;
           offset++;
           if (offset >= expand.size())
-            throw RegexMatcher::Error("wrong format of expand string!");
+            BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
         }
       return expand.substr(begin, offset - begin);
     }
   else
-    throw RegexMatcher::Error("wrong format of expand string!");
+    BOOST_THROW_EXCEPTION(RegexMatcher::Error("wrong format of expand string!"));
 }
 
 shared_ptr<RegexTopMatcher>
diff --git a/src/util/sqlite3-statement.cpp b/src/util/sqlite3-statement.cpp
index 243088b..f1871db 100644
--- a/src/util/sqlite3-statement.cpp
+++ b/src/util/sqlite3-statement.cpp
@@ -35,7 +35,7 @@
 {
   int res = sqlite3_prepare_v2(database, statement.c_str(), -1, &m_stmt, nullptr);
   if (res != SQLITE_OK)
-    throw std::domain_error("bad SQL statement: " + statement);
+    BOOST_THROW_EXCEPTION(std::domain_error("bad SQL statement: " + statement));
 }
 
 int
diff --git a/src/util/string-helper.cpp b/src/util/string-helper.cpp
index fc0e1a1..16064b0 100644
--- a/src/util/string-helper.cpp
+++ b/src/util/string-helper.cpp
@@ -89,7 +89,8 @@
 fromHex(const std::string& hexString)
 {
   if (hexString.size() % 2 != 0) {
-    throw StringHelperError("Invalid number of characters in the supplied hex string");
+    BOOST_THROW_EXCEPTION(StringHelperError("Invalid number of characters in the supplied hex "
+                                            "string"));
   }
 
   using namespace CryptoPP;
@@ -99,7 +100,7 @@
   shared_ptr<const Buffer> buffer = os.buf();
 
   if (buffer->size() * 2 != hexString.size()) {
-    throw StringHelperError("The supplied hex string contains non-hex characters");
+    BOOST_THROW_EXCEPTION(StringHelperError("The supplied hex string contains non-hex characters"));
   }
 
   return buffer;
