Enhance exception throwing with Boost Exception library
Change-Id: I471023fc23ffaebe04d9668426b4c1b03e4962ba
Refs: #2997
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;