libcryptosec
AsymmetricKeyException.h
Go to the documentation of this file.
1 #ifndef ASYMMETRICKEYEXCEPTION_H_
2 #define ASYMMETRICKEYEXCEPTION_H_
3 
5 
7 {
8 public:
9  enum ErrorCode
10  {
17  };
19  {
20  this->where = where;
22  this->details = "";
23  }
25  {
26  this->where = where;
27  this->errorCode = errorCode;
28  this->details = "";
29  }
31  {
32  this->where = where;
33  this->errorCode = errorCode;
34  this->details = details;
35  }
36  virtual ~AsymmetricKeyException() throw () {}
37  virtual std::string getMessage() const
38  {
39  return (AsymmetricKeyException::errorCode2Message(this->errorCode) + ". Details: " + this->details + ".");
40  }
41  virtual std::string toString() const
42  {
43  std::string ret;
45  {
46  ret = "AsymmetricKeyException. Called by: " + this->where + ".";
47  }
48  else
49  {
50  ret = "AsymmetricKeyException: " + AsymmetricKeyException::errorCode2Message(this->errorCode) + ". Called by: " + this->where + ".";
51  }
52  if (this->details != "")
53  {
54  ret += " More details: " + this->details + ".";
55  }
56  return ret;
57  }
59  {
60  return this->errorCode;
61  }
63  {
64  std::string ret;
65  switch (errorCode)
66  {
68  ret = "Unknown error";
69  break;
71  ret = "Set no value";
72  break;
74  ret = "Invalid asymmetric key type";
75  break;
77  ret = "Internal error";
78  break;
80  ret = "Asymmetric key not available";
81  break;
83  ret = "Invalid asymmetric key";
84  break;
85 // case AsymmetricKeyException:::
86 // ret = "";
87 // break;
88  }
89  return ret;
90  }
91 protected:
93 };
94 
95 #endif /*ASYMMETRICKEYEXCEPTION_H_*/
AsymmetricKeyException(AsymmetricKeyException::ErrorCode errorCode, std::string where)
Definition: AsymmetricKeyException.h:24
virtual ~AsymmetricKeyException()
Definition: AsymmetricKeyException.h:36
virtual std::string toString() const
Definition: AsymmetricKeyException.h:41
virtual AsymmetricKeyException::ErrorCode getErrorCode()
Definition: AsymmetricKeyException.h:58
Definition: AsymmetricKeyException.h:13
Definition: AsymmetricKeyException.h:15
Definition: AsymmetricKeyException.h:6
Definition: AsymmetricKeyException.h:14
ErrorCode
Definition: AsymmetricKeyException.h:9
Definition: AsymmetricKeyException.h:16
AsymmetricKeyException(std::string where)
Definition: AsymmetricKeyException.h:18
static std::string errorCode2Message(AsymmetricKeyException::ErrorCode errorCode)
Definition: AsymmetricKeyException.h:62
Definition: LibCryptoSecException.h:8
std::string where
Definition: LibCryptoSecException.h:23
AsymmetricKeyException::ErrorCode errorCode
Definition: AsymmetricKeyException.h:92
std::string details
Definition: LibCryptoSecException.h:24
Definition: AsymmetricKeyException.h:12
virtual std::string getMessage() const
Definition: AsymmetricKeyException.h:37
AsymmetricKeyException(AsymmetricKeyException::ErrorCode errorCode, std::string details, std::string where)
Definition: AsymmetricKeyException.h:30
Definition: AsymmetricKeyException.h:11