exceptions: Make Tlv::Error a base class for all packet-processing exceptions
This commit also includes a number of code style fixes.
Change-Id: I44f83915e733b43d5f43b4266902c8262e928d91
Refs: #1528
diff --git a/src/security/signature-sha256.hpp b/src/security/signature-sha256.hpp
index 8ef37a8..9200ac5 100644
--- a/src/security/signature-sha256.hpp
+++ b/src/security/signature-sha256.hpp
@@ -15,8 +15,19 @@
/**
* Representing of SHA256 signature in a data packet.
*/
-class SignatureSha256 : public Signature {
+class SignatureSha256 : public Signature
+{
public:
+ class Error : public Signature::Error
+ {
+ public:
+ explicit
+ Error(const std::string& what)
+ : Signature::Error(what)
+ {
+ }
+ };
+
SignatureSha256()
{
m_info = Block(Tlv::SignatureInfo);
@@ -29,7 +40,7 @@
: Signature(signature)
{
if (getType() != Signature::Sha256)
- throw Signature::Error("Incorrect signature type");
+ throw Error("Incorrect signature type");
}
};