Infinispan HotRod C++ Client  8.3.1.Final
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
exceptions.h
Go to the documentation of this file.
1 #ifndef ISPN_HOTROD_EXCEPTIONS_H
2 #define ISPN_HOTROD_EXCEPTIONS_H
3 
4 #include <exception>
5 #include <string>
6 #include <stdint.h>
9 
10 namespace infinispan {
11 namespace hotrod {
12 
13 class HR_EXTERN Exception: public std::exception {
14 public:
15  explicit Exception(const std::string& message = std::string()) throw ();
16  virtual ~Exception() throw ();
17  virtual const char* what() const throw ();
18 
19 protected:
20  std::string message;
21 };
22 
27 class HR_EXTERN HotRodClientException: public Exception {
28 public:
29  explicit HotRodClientException(const std::string&);
30  HotRodClientException(const std::string& message_, uint64_t message_id_, uint8_t status_);
31  virtual ~HotRodClientException() throw ();
32  virtual const char* what() const throw ();
33  private:
34  uint64_t message_id;
35  uint8_t status;
36 };
37 
44 public:
45  TransportException(const std::string& host, int port, const std::string&, int);
46  ~TransportException() throw ();
47 
48  const std::string &getHost() const {
49  if (hostPtr.get() == NULL) {
50  const_cast<TransportException *>(this)->hostPtr.reset(new std::string(host.c_str()));
51  }
52  return *(hostPtr.get());
53  }
54  const char *getHostCString() const;
55  int getPort() const;
56  int getErrnum() const {
57  return errnum;
58  }
59 private:
60  const std::string host;
61  __pragma(warning(suppress:4251))
62  std::shared_ptr<std::string> hostPtr;
63  int port;
64 
65  int errnum;
66 };
67 
74 public:
75  InvalidResponseException(const std::string&);
76 };
77 
84 public:
85  RemoteNodeSuspectException(const std::string&, uint64_t message_id, uint8_t status);
86 };
87 
93 public:
94  InternalException(const std::string&);
95 };
96 
104 public:
105  RemoteCacheManagerNotStartedException(const std::string&);
106 };
107 
114 };
115 
117 public:
118  HotRodClientTxStateException(const std::string& state, const std::string& action);
119 };
120 
122 public:
123  HotRodClientRollbackException(unsigned int exCode);
124  unsigned int getStatus() const { return status; }
125 private:
126  unsigned int status;
127 };
128 
130 public:
131  HotRodClientTxRemoteStateException(unsigned int status);
132 
133  unsigned int getStatus() const
134  {
135  return status;
136  }
137 private:
138  unsigned int status;
139 };
140 
145 class HR_EXTERN CounterUpperBoundException: public Exception {
146 public:
147  CounterUpperBoundException(const std::string& name) :
148  Exception(std::string("Upper bound violated. Counter name ") + name), name(name) {
149  }
150  std::string name;
151 };
152 
157 class HR_EXTERN CounterLowerBoundException: public Exception {
158 public:
159  CounterLowerBoundException(const std::string& name) :
160  Exception(std::string("Lower bound violated. Counter name ") + name), name(name) {
161  }
162  std::string name;
163 };
164 
165 }
166 } // namespace
167 
168 #endif /* ISPN_HOTROD_EXCEPTIONS_H */
#define HR_EXTERN
Definition: ImportExport.h:35
Definition: exceptions.h:43
int getErrnum() const
Definition: exceptions.h:56
unsigned int getStatus() const
Definition: exceptions.h:124
std::string name
Definition: exceptions.h:150
std::string name
Definition: exceptions.h:162
const std::string & getHost() const
Definition: exceptions.h:48
Definition: exceptions.h:92
CounterUpperBoundException(const std::string &name)
Definition: exceptions.h:147
#define __pragma(...)
Definition: defs.h:106
unsigned int getStatus() const
Definition: exceptions.h:133
CounterLowerBoundException(const std::string &name)
Definition: exceptions.h:159