libcryptosec
RandomException.h
Go to the documentation of this file.
1 #ifndef RANDOMEXCEPTION_H_
2 #define RANDOMEXCEPTION_H_
3 
5 
7 {
8 public:
9  enum ErrorCode
10  {
15  };
16  RandomException(std::string where)
17  {
18  this->where = where;
20  }
22  {
23  this->where = where;
24  this->errorCode = errorCode;
25  }
26  virtual ~RandomException() throw () {}
27  virtual std::string getMessage() const
28  {
30  }
31  virtual std::string toString() const
32  {
33  std::string ret;
35  {
36  ret = "RandomException. Called by: " + this->where + ".";
37  }
38  else
39  {
40  ret = "RandomException: " + RandomException::errorCode2Message(this->errorCode) + ". Called by: " + this->where + ".";
41  }
42  return ret;
43  }
45  {
46  return this->errorCode;
47  }
49  {
50  std::string ret;
51  switch (errorCode)
52  {
54  ret = "Unknown error";
55  break;
57  ret = "No data seeded";
58  break;
60  ret = "Default random engine has not implemented this function";
61  break;
63  ret = "Internal error";
64  break;
65 // case RandomException:::
66 // ret = "";
67 // break;
68  }
69  return ret;
70  }
71 
72 protected:
74 };
75 
76 #endif /*RANDOMEXCEPTION_H_*/
RandomException(RandomException::ErrorCode errorCode, std::string where)
Definition: RandomException.h:21
Definition: RandomException.h:11
virtual ~RandomException()
Definition: RandomException.h:26
Definition: RandomException.h:6
RandomException(std::string where)
Definition: RandomException.h:16
virtual RandomException::ErrorCode getErrorCode()
Definition: RandomException.h:44
ErrorCode
Definition: RandomException.h:9
Definition: RandomException.h:14
virtual std::string toString() const
Definition: RandomException.h:31
RandomException::ErrorCode errorCode
Definition: RandomException.h:73
virtual std::string getMessage() const
Definition: RandomException.h:27
Definition: RandomException.h:12
Definition: LibCryptoSecException.h:8
std::string where
Definition: LibCryptoSecException.h:23
static std::string errorCode2Message(RandomException::ErrorCode errorCode)
Definition: RandomException.h:48
Definition: RandomException.h:13